A few fun nesting tips & tricks
There are some handy things that you can do with nesting, espcially when you start moving the & placeholder around!
There are some handy things that you can do with nesting, espcially when you start moving the & placeholder around!
Did you know you can control the border radius of both sides of a corner indepenently of one another? It might seem a little strange to do, but you can do some intersting things with it!
Sometimes, designs have different images for large and small screen layouts. In those situations, it can be tempting to simply bring in multiple images and use a media query in your CSS to control when we see each one, but the <picture> element is purpose-built for these situations.
It might seem strange, but single-colour gradients can come in handy in a few different ways!
Register custom CSS properties with specific syntax to enable smooth animations and transitions.
Select elements by counting backwards from the end using the :nth-last-child pseudo-class selector.
Crop images in a similar to way background images by using object-fit and object-position
We can now do calculations based on the intrinsic size of an element
Add a little personality to your site by changing the selection styles
Display calculation results and user interaction outcomes with semantic HTML using the output element.
Style the first and last elements in a group without needing extra classes or JavaScript.
Create autocomplete dropdowns with suggestions using the datalist element without JavaScript.
A quick look at the :not-in-range psuedo-class.
A quick look at the :placeholder-shown pseudo-class for styling form elements that are displaying placeholder text.
Animate and transition to auto, and other intrinsic keyword values.
Easily add a color picker to your page using an input with a type of color.
Learn how to use the :only-child selector to style elements differently when they have no siblings. Perfect for adaptive designs with optional elements like figure captions. Plus, see how combining it with :has() creates powerful parent styling possibilities.
The CSS min() and max() functions can be powerful alternatives to clamp() for responsive layouts.
When creating quotes in HTML, most people are aware of the <blockquote> element, but for shorter quotes you might want an inline element, and that is where the <q> element comes in
Number inputs can be useful, but they aren't as straight forward as they might seem at first.
Style inputs based on if the value is within specific range limits
A quick look at the search element, a semantic element for search and filtering
The :has() relational selector allows you to select parents of elements, but also preceding elements, siblings, and much more!
Two new CSS features, @starting-style and allow-discrete, making it quite easy to transition to and from display: none!
:focus-visible is an improved version of :focus, meaning we don't have to fight those focus rings
Responsive units that respond to local sizes, rather than the entire viewport
Text wraps, but only as a last resort!
A new and improved version of :valid that only kicks in once the user has interacted with the field
An underused HTML element for when we want to show keyboard commands and user inputs.
We can use CSS to find elements that don't have any content in them.
If you want to make sure you never miss an update, you can sign up below to get them delivered straight to your inbox, or you can subscribe to the RSS feed.