Category: CSS

  • The Modern Guide For Making CSS Shapes

    Creating shapes using CSS is, without any doubt, a classic exercise. In many cases, we try to use hacky code and workarounds, but CSS has evolved, and we have modern ways to create CSS Shapes with clean, reusable code. In this comprehensive guide, Temani Afif explores different techniques for creating common shapes with the smallest…

    Read more...

  • Combining CSS :has() And HTML For Greater Conditional Styling

    While the CSS :has() pseudo-class is widely celebrated for its ability to select a parent element up the chain conditionally based on its contents, there is more conditional logic it is capable of handling when we move it up the chain, so to speak. Amit Sheen demonstrates using :has() to apply styles conditionally when a certain <option> in a <select> element is chosen…

    Read more...

  • Sliding 3D Image Frames In CSS

    Creating 3D effects in CSS isn’t an entirely new concept, but typical approaches use additional elements in the markup and pseudo-elements in the styles to pull it off. What if you don’t have the luxury of being able to modify the HTML in your project? Temani Afif rises to the challenge, applying 3D effects and…

    Read more...

  • Infinite-Scrolling Logos In Flat HTML And Pure CSS

    Editor’s Note: This article has been updated with additional accessibility considerations for motion sensitivities. Remember the HTML <marquee> element? It’s deprecated, so it’s not like you’re going to use it when you need some sort of horizontal auto-scrolling feature. That’s where CSS comes in because it has all the tools we need to pull it off. Silvestar Bistrović…

    Read more...

  • Setting And Persisting Color Scheme Preferences With CSS And A “Touch” Of JavaScript

    There are many ways to approach a “Dark Mode” feature that respects a user’s system color scheme preferences and allows for per-site customization. With recent developments in CSS, core functionality that has always required JavaScript can now be done without it. Henry Bley-Vroman walks through a new possibility that leans into cutting-edge CSS, with minimal…

    Read more...

  • How To Draw Radar Charts In Web

    A radar chart — also commonly called a spider chart — is yet another way to visualize data and make connections. Radar charts are inherently geometric, making them both a perfect fit and fun to make with CSS, thanks to the polygon() function. Read along as Preethi Sam demonstrates the process and sprinkles it with a pinch…

    Read more...

  • CSS Blurry Shimmer Effect

    Box shadows are fairly straightforward in CSS: declare the box-shadow property, set the shadow offsets, define the spread, and give it a color. It’s a great way to add depth to what might be an otherwise flat design! Taking inspiration from shadows, author Yair Even Or creates the same sort of thing, only with a blurring effect…

    Read more...

  • New CSS Viewport Units Do Not Solve The Classic Scrollbar Problem

    Since the introduction of CSS viewport units in 2012, many of us have been using width: 100vw as a way to set an element’s width to the full width of the viewport. But, as Šime Vidas explains in this deep dive, 100vw does not always represent the full width of the viewport due to differences in how browsers handle…

    Read more...

  • CSS Scroll Snapping Aligned With Global Page Layout: A Full-Width Slider Case Study

    Have you run into a situation where you need the padding of one element to align with the padding of another element? It’s a common debacle, especially when a page layout is set with global padding, and you need to break out of that layout and go full-width but still align the inner content with…

    Read more...

  • A Few Ways CSS Is Easier To Write In 2023

    We’re living in somewhat of a CSS renaissance with new features, techniques, experiments, and ideas coming at us to an extent we haven’t seen since “CSS3”. It’s easy to feel overwhelmed when your profession seems to be advancing at breakneck speed, but it’s just as easy to be excited and inspired by what’s possible today…

    Read more...