Smashing Magazine - #386: CSS

With CSS skewed highlights, CSS trees, CSS overlaps and shiny new CSS techniques. Issue #386 Jan 23, 2023 View in the browser 💨

Smashing Newsletter

Namaste Smashing Friends,

2023 is here, a new year with new hopes, new goals and new experiences. And as we’re diving into the new year, we’d like to send you a lot of positive energy and optimism in hopes that 2023 will bring us all peace, stability, calmness and plenty of wonderful and unforgettable memories of that year. Good memories, with a lot of fun, laughter, and human kindness shared with your family and friends. It’s about time.

In this very first edition of the newsletter this year, we’d love to start with something that’s always been very close to our hearts: CSS. Below you’ll find a few useful CSS techniques that hopefully will help you resolve some of your UI troubles.

And perhaps as a good start to the year, let’s begin with an act of kindness. Send a word of support to everybody who needs it, send a kind message or make somebody smile, or tell them how much you love and appreciate them. And: don’t forget to reserve time for yourself in your calendar before it gets blocked with all the meetings.

Have a good one, everyone!

Vitaly (@vitalyf)


1. Skewed Highlights With CSS

So you need to design a “highlighter” effect using only CSS while adapting to text changes. How would you go around building it? In his tutorial on Skewed Highlight, Vadim Makeev describes a simple way to make it work.

Skewed Highlights With CSS
Skewed Highlights With CSS

Vadim suggests using the <mark> element, with side angles achieved with CSS gradients: left and right rectangles with a diagonal gradient and a part in between with just a fill. And if the text wraps onto multiple lines, we can use box-decoration-break: clone, so every line of the <mark> element is decorated like its own element. Solved! And it looks fantastic! (vf)


2. Tree Views In CSS

We all had to create a tree view at some point: a collapsible list with nested accordions resembling a file folder structure. Typically we would use JavaScript to make it work, but as it turns out, that’s really not necessary.

Tree Views In CSS

In CSS Tree Views, Kate Rose Morley provides a tutorial on how to make the tree view work with a few simple nested lists and <details>/<summary> inside of each list item. Screen readers will understand the tree view as lists nested inside disclosure widgets, and the standard keyboard interaction is supported automatically. Et voila! (vf)


3. Overlaps In CSS

So your designer wants stuff to overlap. Perhaps it’s a few boxes that belong together, but one needs to live on top of another. Or maybe you have boxes stacked atop boxes next to boxes nested within boxes. That’s the trouble that Hui Jing has run into. And she decided to figure it out once and for good.

Overlaps In CSS

In her article, Hui Jing explored various options to get things just right, from negative margins and translation using transform to absolute positioning and CSS Grid. In the end, the easiest way to reason with layout seemed to be CSS Grid, with each item not “disturbing” others on the grid, and we can use the box-alignment properties to adjust them within their allocated spaces. (vf)


4. Upcoming SmashingConfs And Workshops

Every year we bring bright and kind people who care about the web to share what they’ve learned. For 2023, we can’t wait to welcome you to SmashingConf Freiburg 2023 (Sep 4–6, 2023) with adventures into design systems, accessibility, CSS/JS and interface design patterns. Get your early-bird ticket!

Smashing Online Events

We’re also very excited about our very first SmashingConf Front-End @ SF 2023 (May 23–26, 2023), entirely focused on cutting-edge front-end. From accessibility and advanced CSS to JavaScript gems and web performance. With a dash of Tailwind, Next.js and TypeScript. Get your early-bird ticket!

Smashing Online Events

As always, here’s an overview of our upcoming workshops:


5. CSS Blend Modes

Blending modes are a way of creating new colors based on two input colors, a foreground color, and a background color. There are plenty of options out there, but how exactly would we apply them in CSS?

CSS Blend Modes

In his post, Scott Vandehey shows how to create some nifty effects with CSS blend modes by using radial gradients, a layered breakdown approach for filters, and then applying mix-blend mode to the result. Michelle Barker highlights more visual effects in CSS Halftone patterns, too. (vf)


6. Twelve Days Of Web

A celebration of CSS has just wrapped up on 12 Days of Web. It’s a lovely project curated by Stephanie Eckles every year to highlight the wonders of CSS. This year, there is quite a menu: from new viewport units and CSS image() to cascade layers, CSS scroll snap, :has() and CSS subgrid.

12 Days Of Web

All articles come with ready-to-use demos and detailed tutorials, and Stephanie also reviews exciting additions to CSS that became fully or nearly cross-browser in 2022: container queries, :focus-visible, accent-color, overscroll-behavior, and (almost there!) subgrid! The article also highlights references to articles to get started. What a time to write CSS! (vf)


7. CSS Style Queries

With container queries available in the browsers already, we might settle down and get used to replacing media queries with container queries and call it a day. But not so fast. Recently, the Chrome team released experimental support for a new proposed CSS spec and style queries. And it might be quite a game-changer, too.

CSS Style Queries

CSS style queries allow us to query a container based on its style rather than just its size, e.g. we could check if the container is a Flexbox and then style the child based on that. Or we could adjust the color of a headline if it lives on top of a dark photo. In CSS Container Style Queries, Ahmad Shadeed goes through a few use cases and shows how to use style queries.

There are plenty of fine details covered by Una Kravets in her article Style Queries, too. Browser support? Currently still considered to be experimental and is only implemented in Chrome Canary. (vf)


8. CSS Mesher

Who doesn’t like a lovely gradient? Or perhaps even a palette of gradients that would make up a beautiful mesh gradients mess, only with CSS? CSS Mesher allows you to choose a randomly generated CSS mesh or finetune the colors to create a perfect custom one.

CSS Mesher

And if you need a few more generators for all your visual needs, SVG Generators and CSS Generators are handy little round-ups we prepared a while back, featuring everything from doodle patterns and text warping to perfect shadows and funky border-radii! Ones for the bookmarks! (vf)


9. New On Smashing Job Board


10. Recent Smashing Articles


That’s All, Folks!

Thank you so much for reading and for your support in helping us keep the web dev and design community strong with our newsletter. See you next time!


This newsletter issue was written and edited by Cosima Mielke (cm), Vitaly Friedman (vf) and Iris Lješnjanin (il).


Sent to truly smashing readers via Mailchimp.
We sincerely appreciate your kind support. You
rock.

Follow us on Twitter Join us on Facebook

unsubscribe update preferences view in your browser

Older messages

#385: Getting Ready For 2023!

Tuesday, December 27, 2022

Keyboard shortcuts, tech teams app stacks, AI tooling for designers, terms of services and licenses explained. Issue #385 • December 27, 2022 • View in the browser 💨 Smashing Newsletter Dobroho vechora

#384: Color and Data Visualization

Tuesday, December 20, 2022

Color management, data visualization guidelines, typography for data charts, color contrast and accessible data visualizations. Issue #384 • December 20, 2022 • View in the browser 💨 Smashing

#383: Psychology and UX

Tuesday, December 13, 2022

Behavioral science, user interviews, product design methods, UX research and design system ROI calculator. Issue #383 • December 13, 2022 • View in the browser 💨 Smashing Newsletter Goeije 'n avend

#382: Front-End & UX Advent Calendars

Tuesday, December 6, 2022

With advent calendars on accessibility, CSS/JS, UX and Web Performance. Issue #382 • December 6, 2022 • View in the browser 💨 Smashing Newsletter Gamarjoba Smashing Friends, It's December! So

#381: Interface Design

Tuesday, November 29, 2022

Dashboard design patterns, behavioral science, design principles, Figma plugins and easing gradients. Issue #381 • November 22, 2022 • View in the browser 💨 Smashing Newsletter Tere Smashing Friends,

You Might Also Like

At Home With Gloria Steinem

Thursday, December 26, 2024

View in your browser | Update your preferences ADPro Glory, Gloria Every year our AD100 honorees fill out a survey of projects that they're working on. A year or so ago, longtime AD100 designer

Celeb Homes at the Holidays—and a Few More Things to Make You Merry

Tuesday, December 24, 2024

View in your browser | Update your preferences ADPro Holiday Cheer Whether your taste leans traditional, modern, or all-out extravagant, AD is rife with inspiration for your holiday. In the spirit of

#488: Fun And Useful Gems

Tuesday, December 24, 2024

Radio garden, Zoom backgrounds, visual history of the alphabet and fun interactive experiences. Issue #488 • Dec 24, 2024 • View in the browser Smashing Newsletter Hello Smashing Friends, As we are

Accessibility Weekly #428: Putting AI to the (Accessibility) Test

Monday, December 23, 2024

December 23, 2024 • Issue #428 View this issue online or browse the full issue archive. Hey accessibility friends! It's the time of year where news and information slows down as many people take

2024 magic moments

Sunday, December 22, 2024

Issue 225: The year from my personal lens ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏

Planning mode

Friday, December 20, 2024

Lessons from our first-ever annual planning sprint ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏

We Co-Sign This AD100-Approved Trend

Thursday, December 19, 2024

View in your browser | Update your preferences ADPro Emboldening the Bath Marble, marble, everywhere, and every drop is chic. According to AD100 designer Jake Arnold, “material drenching”—that is,

177 / Keep calm by listening to these ambient sounds

Thursday, December 19, 2024

Product Disrupt Logo Product Disrupt Half-Monthly Dec 2024 • Part 1 View in browser Welcome to Issue 177 Lately, I've been driving a lot of inspiration from the things I see in real life. The range

The Year in Color: Hella Jongerius, Mocha Mousse, and More

Thursday, December 19, 2024

View in your browser | Update your preferences ADPro Color Our World Since the summer, AD PRO has kept its finger on the pulse of color predictions. Overall, the vibe right now is down to earth,

🐺Get Media Features in 2025

Thursday, December 19, 2024

A BIG Wolf Craft announcement!! ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏