Making Things Better: Redefining the Technical Possibilities of CSS
Publikováno: 3.3.2020
(This is a sponsored post.)
Robin recently lamented the common complaint that CSS is frustrating. There are misconceptions about what it is and what it does. There are debates about what kind of language it is. There are even different views on where it should be written.
Rachel Andrew has a new talk from An Event Apart DC 2019 available that walks us back; back to the roots of the issues we used to have with CSS and … Read article
The post Making Things Better: Redefining the Technical Possibilities of CSS appeared first on CSS-Tricks.
(This is a sponsored post.)
Robin recently lamented the common complaint that CSS is frustrating. There are misconceptions about what it is and what it does. There are debates about what kind of language it is. There are even different views on where it should be written.
Rachel Andrew has a new talk from An Event Apart DC 2019 available that walks us back; back to the roots of the issues we used to have with CSS and the "hacks" we used to overcome them. CSS has changed a lot over the past few years and, while those changes have felt complex and confusing at times, they are designed to solve what we have always wanted CSS to do.
The full hour it takes to watch the talk is well worth the time. Here are a few nuggets that stood out. First off, some de-bunking of common CSS complaints:
- You never know how tall anything is on the web. Floats never solved this because they only bring things next to each other instead of knowing about the items around them. New layout methods, including CSS Grid and Flexbox, actually look at our elements and help them behave consistently.
- Flexbox is weird and unintuitive. It's not the layout method you might think it is. If we view it as a way to line things up next to each other, it's going to feel weird and behavior weirdly as well. But if we see it for what it is - a method that looks at differently sized elements and returns the most logical layout - it starts to make sense. It assigns space, rather than squishing things into a box.
Rachel continues by giving us a peek into the future of what CSS wants to do for us:
- CSS wants to avoid data loss. New alignment keywords like
safe
andunsafe
will give us extra control to define whether we want CSS to aggressively avoid content that's unintentionally hidden or allow it to happen.
.container {
display: flex;
flex-direction: column;
/* Please center as long as it doesn't result in overflow */
align-items: safe center;
}
- CSS wants to help us get real with overflow. The
min-content
andmax-content
keywords make it possible to create boxes that are wide enough for the content but not wider, and boxes that are as big as the content can be.
.container {
width: min-content; /* Allow wrapping */
}
- CSS wants to lay things out logically. The web is not left-to-right. Grid and Flexbox quietly introduced a way of thinking start-to-end that is direction agnostic. That has brought about a new specification for Logical Properties and Values.
- CSS wants to make content more portable.CSS Regions let us flow content from one element into another. While it's probably a flawed comparison, it's sorta like the pipes in old school Mario Bros. games where jumping in one pipe at one location will plop your character out of another pipe in another location... but we get to define those sources ourselves and without angry plants trying to eat us along the way.
Anyway, these are merely scratching the surface of what Rachel covers in her talk. It's a good reminder that An Event Apart has an entire library of valuable talks from amazing speakers and that attending an AEA event is an invaluable experience worth checking out. Rachel's talk was from last year's Washington D.C. event and, as it turns out, the very next event is taking place there this April 13-15. If you can't make that one, there are several others throughout the year across the United States.
Oh, and of course we have a discount code for you! Use AEACP
for $100 off any show.
Direct Link to Article — Permalink
The post Making Things Better: Redefining the Technical Possibilities of CSS appeared first on CSS-Tricks.