Building a Settings Component

This is a tremendous CSS-focused tutorial from Adam Argyle. I really like the “just for gap” concept here. Grid is extremely powerful, but you don’t have to use all its abilities every time you reach for it. Here, Adam …


The post Building a Settings Component appeared first on CSS-Tricks.

You can support CSS-Tricks by being an MVP Supporter.


This content originally appeared on CSS-Tricks and was authored by Chris Coyier

This is a tremendous CSS-focused tutorial from Adam Argyle. I really like the “just for gap” concept here. Grid is extremely powerful, but you don’t have to use all its abilities every time you reach for it. Here, Adam reaches for it for very light reasons like using it as an in-between border alternative as well as more generic spacing. I guess he’s putting money where his mouth is in terms of gap superseding margin!

I also really like calling out Una Kravet’s awesome name for flexible grids: RAM. Perhaps you’ve seen the flexible-number-of-columns trick with CSS grid? The bonus trick here (which I first saw from Evan Minto) is to use min(). That way, not only are large layouts covered, but even the very smallest layouts have no hard-coded minimum (like if 100% is smaller than 10ch here):

.el {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(10ch, 100%), 35ch));
}

There is a ton more trickery in the blog post. The “color pops” with :focus-within is fun and clever. So much practical CSS in building something so practical! 🧡 more blog posts like this, please. Fortunately, we don’t have to wait, as Adam has other component-focused posts like this one on Tabs and this one on Sidenav.

Direct Link to ArticlePermalink


The post Building a Settings Component appeared first on CSS-Tricks.

You can support CSS-Tricks by being an MVP Supporter.


This content originally appeared on CSS-Tricks and was authored by Chris Coyier


Print Share Comment Cite Upload Translate Updates
APA

Chris Coyier | Sciencx (2021-04-14T21:08:24+00:00) Building a Settings Component. Retrieved from https://www.scien.cx/2021/04/14/building-a-settings-component-3/

MLA
" » Building a Settings Component." Chris Coyier | Sciencx - Wednesday April 14, 2021, https://www.scien.cx/2021/04/14/building-a-settings-component-3/
HARVARD
Chris Coyier | Sciencx Wednesday April 14, 2021 » Building a Settings Component., viewed ,<https://www.scien.cx/2021/04/14/building-a-settings-component-3/>
VANCOUVER
Chris Coyier | Sciencx - » Building a Settings Component. [Internet]. [Accessed ]. Available from: https://www.scien.cx/2021/04/14/building-a-settings-component-3/
CHICAGO
" » Building a Settings Component." Chris Coyier | Sciencx - Accessed . https://www.scien.cx/2021/04/14/building-a-settings-component-3/
IEEE
" » Building a Settings Component." Chris Coyier | Sciencx [Online]. Available: https://www.scien.cx/2021/04/14/building-a-settings-component-3/. [Accessed: ]
rf:citation
» Building a Settings Component | Chris Coyier | Sciencx | https://www.scien.cx/2021/04/14/building-a-settings-component-3/ |

Please log in to upload a file.




There are no updates yet.
Click the Upload button above to add an update.

You must be logged in to translate posts. Please log in or register.