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

Key phrases

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

9 Trends From Milan We Can’t Stop Thinking About

Thursday, April 25, 2024

View in your browser | Update your preferences ADPro Even More From Milan Design Week Each year, the design world convenes in Milan—and that applies to us at AD, too. For the third year running, our

Subframe, Attributes vs Properties, Front End Handbook, aspect-ratio, GenAI

Thursday, April 25, 2024

The 5 best design links, every day. Curated by a selection of great editors. Email not displaying properly? View browser version. Sidebar April 25 2024 Subframe subframe.com Subframe is a design-to-

Ritmo, Climate Change, Icons & Typefaces, Click Wheel JS, CarPlay

Wednesday, April 24, 2024

The 5 best design links, every day. Curated by a selection of great editors. Email not displaying properly? View browser version. Sidebar April 24 2024 Meet Ritmo, Musixmatch's cross-platform

Why Jake Arnold Doesn’t Text Clients

Tuesday, April 23, 2024

View in your browser | Update your preferences We've had a remodel! From now on, you'll be hearing from AD PRO in your inbox twice a week—once with a deep dive into trends to watch and subjects

The secret ingredient to media success

Tuesday, April 23, 2024

PR tips from our founder Nora Wolf In this month's edition is all about *the most important* element of successful media outreach—photography. You may have some photos, but if the backgrounds are

#453: Design Systems

Tuesday, April 23, 2024

Design system generator, types of design systems and how to consolidate design systems. Issue #453 • Apr 23, 2024 • View in the browser Smashing Newsletter Buổi tối vui vẻ Smashing Friends, Ah, design

👨‍🏫 Striking Educational Website Designs + 🏆 Challenge Updates

Tuesday, April 23, 2024

Your UpLabs Design Updates Await! Let's Get Going! 🎨 Firstly, let's congratulate Mariana Gameiro, the winner of our latest 👩‍💻 SheCodes Website Redesign Challenge! Congratulations!! Secondly,

Code Connect, JS Naked Day, Shape of AI, Product Design, CSS Grid Level 3

Tuesday, April 23, 2024

The 5 best design links, every day. Curated by a selection of great editors. Email not displaying properly? View browser version. Sidebar April 23 2024 The Right Code for Your Design System figma.com

Accessibility Weekly #393: When Security and Accessibility Clash

Monday, April 22, 2024

April 22, 2024 • Issue #393 View this issue online or browse the full issue archive. Featured: When security and accessibility clash: Why are banking applications so inaccessible? "While using

Bézier Curves, CSS Motion Extraction, CSS Testing, CSS Theming, Women Who Code

Monday, April 22, 2024

The 5 best design links, every day. Curated by a selection of great editors. Email not displaying properly? View browser version. Sidebar April 22 2024 Flattening Bézier Curves and Arcs minus-ze.ro