CSS-Tricks
source link: https://css-tricks.com/
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.
Fluid Images in a Variable Proportion Layout
Creating fluid images when they stand alone in a layout is easy enough nowadays. However, with more sophisticated interfaces we often have to place images inside responsive elements, like this card:
For now, let’s say this image is not semantic content, but only decoration. That’s a good use for background-image. And because in this context the image contains an object, we can’t allow any parts to be cropped out when it’s responsive, so we’d pick background-size: contain
.
Here’s where … Read article “Fluid Images in a Variable Proportion Layout”
Settling down in a Jamstack world
One of the things I like about Jamstack is that it’s just a philosophy. It’s not particularly prescriptive about how you go about it. To me, the only real requirement is that it’s based on static (CDN-backed) hosting. You can use whatever tooling you like. Those tools, though, tend to be somewhat new, and new sometimes comes with issues. Some pragmatism from Sean C Davis here:
… Read article “Settling down in a Jamstack world”I have two problems with solving problems using the newest, best tool every
Some Performance Links
Just had a couple of good performance links burning a hole in my pocket, so blogging them like a good little blogger.… Read article “Some Performance Links”
Refreshing Sidebar for 2020
The new design for Sidebar is lovely. I like how it goes even deeper with the sticky elements than the last design.
But even more notably, Sacha Greif has been posting five links per day to Sidebar since 2012. That’s a remarkable achievement.… Read article
When a Line Doesn’t Break
We expect a line to break when the text on that line reaches the parent box boundaries. We see this every time we create a paragraph, just like this one. When the parent box doesn’t have enough room for the next word in a line, it breaks it and moves down to the next line and repeats that process.
Well, that’s how it works when words are separated by spaces or other whitespace. As far as CSS goes, there are … Read article “When a Line Doesn’t Break”
How-to guide for creating edge-to-edge color bars that work with a grid
Hard-stop gradients are one of my favorite CSS tricks. Here, Marcel Moreau combines that idea with CSS grid to solve an issue that’s otherwise a pain in the butt. Say you have like a 300px right sidebar on a desktop layout with a unique background color. Easy enough. But then say you want that background color to stretch to the right edge of the browser window even though the grid itself is width-constrained. Tricker.… Read article
A Complete Guide to Dark Mode on the Web
New in Chrome: CSS Overview
Here’s a fancy new experimental feature in Chrome! Now, we can get an overview of the CSS used on a site, from how many colors there are to the number of unused declarations… even down to the total number of defined media queries.… Read article “New in Chrome: CSS Overview”
Global and Component Style Settings with CSS Variables
The title of this Sara Soueidan article speaks to me. I’m a big fan of the idea that some CSS is best applied globally, and some CSS is best applied scoped to a component. I’m less interested in how that is done and more interested in just seeing that conceptual approach used in some fashion.
Sara details an approach where components don’t have too much styling by default, but have CSS custom properties applied to them that are ready to … Read article “Global and Component Style Settings with CSS Variables”
Responsive Styling Using Attribute Selectors
Recommend
About Joyk
Aggregate valuable and interesting links.
Joyk means Joy of geeK