Home/Temani Afif
Author
TATemani Afif

Temani Afif

64 articles by Temani Afif.

Frontend — Re-Implementing :nth-child() With Modern CSS

Re-Implementing :nth-child() With Modern CSS

Combining :nth-child with style queries and sibling-index() to conditionally select child elements. Re-Implementing :nth-child() With Modern CSS originally handwritten and published with love on CSS-Tricks . You should really get the newsletter as well.

TATemani AfifTemani Afif·November 3, 2026Frontend
Frontend — The State of CSS Centering in 2026

The State of CSS Centering in 2026

Despite the countless number of online resources, it’s easy to get confused when trying to center an element. There are documented solutions, but do you really understand why the code you picked works? Let's look at the current state of centering options today in 2026.

TATemani AfifTemani Afif·May 22, 2026Frontend
Frontend — Making Complex CSS Shapes Using shape()

Making Complex CSS Shapes Using shape()

Creating rectangles, circles, and rounded rectangles is the basic of CSS. Creating more complex CSS shapes such as triangles, hexagons, stars, hearts, etc. is more challenging but still a simple task if we rely on modern features.

TATemani AfifTemani Afif·April 2, 2026Frontend
Frontend — Making a Responsive Pyramidal Grid With Modern CSS

Making a Responsive Pyramidal Grid With Modern CSS

This is the second part of a small two-part series. In this article, we will explore another type of grid: a pyramidal one. We are still working with hexagon shapes, but a different organization of the elements., while exploring other different shapes.

TATemani AfifTemani Afif·February 12, 2026Frontend
Frontend — Responsive Hexagon Grid Using Modern CSS

Responsive Hexagon Grid Using Modern CSS

A while back, Temani tacked a repeating grid of hexagon shapes. Well, he's updated it with modern CSS features that result in fewer magic numbers. And it's impressive!

TATemani AfifTemani Afif·January 23, 2026Frontend
Frontend — Responsive List of Avatars Using Modern CSS (Part 1)

Responsive List of Avatars Using Modern CSS (Part 1)

A list of rounded images that slightly overlap each other is a classic web design pattern. The main idea is not complex, but the new thing is the responsive part. that dynamically adjusts the overlap between the images so they fit inside the container.

TATemani AfifTemani Afif·December 15, 2025Frontend
Frontend — Better CSS Shapes Using shape() — Part 3: Curves

Better CSS Shapes Using shape() — Part 3: Curves

This is the third article in a series about the CSS shape() function. We've covered drawing lines and arcs in previous articles and, this time, we look specifically at the curve command and how to use it for drawing complex shapes.

TATemani AfifTemani Afif·June 6, 2025Frontend
Frontend — A CSS-Only Star Rating Component and More! (Part 2)

A CSS-Only Star Rating Component and More! (Part 2)

In this second article of a two-part series, Temani Afif demonstrates an alternative approach to creating the star rating component from the first article using experimental scroll-driven animations rather than using the border-image property.

TATemani AfifTemani Afif·March 7, 2025Frontend
Frontend — CSS Tricks That Use Only One Gradient

CSS Tricks That Use Only One Gradient

CSS gradients have been so long that there’s no need to rehash what they are and how to use them. You have surely encountered them at some point in your

TATemani AfifTemani Afif·October 11, 2024Frontend
Frontend — Sliding 3D Image Frames In CSS — Smashing Magazine

Sliding 3D Image Frames In CSS — Smashing Magazine

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. Temani Afif applies 3D effects and sliding transitions to a single `` using clever CSS techniques that demonstrate advanced, modern styling practices.

TATemani AfifTemani Afif·April 12, 2024Frontend
Frontend — Modern CSS Tooltips And Speech Bubbles (Part 2) — Smashing Magazine

Modern CSS Tooltips And Speech Bubbles (Part 2) — Smashing Magazine

In Part 1 of this series, Temani Afif explored different CSS techniques to create tooltip shapes. The main challenge was to rely on a single element and create optimized code that could easily be controlled using CSS variables to update the size, shape, and position of the tail. In this second part, you are going explore more shapes.

TATemani AfifTemani Afif·March 8, 2024Frontend
Frontend — Modern CSS Tooltips And Speech Bubbles (Part 1) — Smashing Magazine

Modern CSS Tooltips And Speech Bubbles (Part 1) — Smashing Magazine

Tooltips are a very common pattern used in CSS for years. There are a lot of ways to approach tooltips in CSS, though some evoke headaches with all the magic numbers they require. In this article, Temani Afif presents modern techniques to create tooltips with the smallest amount of markup and the greatest amount of flexibility.

TATemani AfifTemani Afif·March 1, 2024Frontend
Frontend — CSS Responsive Multi-Line Ribbon Shapes (Part 2) — Smashing Magazine

CSS Responsive Multi-Line Ribbon Shapes (Part 2) — Smashing Magazine

In Part 1 of the series, Temani Afif demonstrated how creating ribbon patterns in CSS has evolved with the availability of new CSS features. In this second installment of this brief two-part series, we look at two additional ribbon variations that introduce techniques for masking a repeated background gradient in CSS.

TATemani AfifTemani Afif·November 22, 2023Frontend
Frontend — CSS Responsive Multi-Line Ribbon Shapes (Part 1) — Smashing Magazine

CSS Responsive Multi-Line Ribbon Shapes (Part 1) — Smashing Magazine

Ribbons have been used to accent designs for many years now. But, the way we approach them in CSS has evolved with the introduction of newer features. In this article, Temani Afif combines background and gradient tricks to create ribbon shapes in CSS that are not only responsive but support multi-line text and are easily adjustable with a few CSS variables.

TATemani AfifTemani Afif·November 15, 2023Frontend
Frontend — Revealing Images With CSS Mask Animations — Smashing Magazine

Revealing Images With CSS Mask Animations — Smashing Magazine

Let’s play with images and experiment with CSS masks. The idea is fairly simple: take a single `` tag and harness the power of CSS to accomplish complex hover transitions. Through different demos, you will see how CSS masks combined with gradients allow us to create fancy effects — with efficient, reusable code.

TATemani AfifTemani Afif·September 15, 2023Frontend
Frontend — A Fancy Hover Effect For Your Avatar

A Fancy Hover Effect For Your Avatar

Do you know that kind of effect where someone’s head is poking through a circle or hole? The famous Porky Pig animation where he waves goodbye while popping

TATemani AfifTemani Afif·February 3, 2023Frontend
Frontend — CSS Infinite 3D Sliders

CSS Infinite 3D Sliders

In this series, we’ve been making image sliders with nothing but HTML and CSS. The idea is that we can use the same markup but different CSS to get wildly

TATemani AfifTemani Afif·December 16, 2022Frontend
Frontend — Making Static Noise From a Weird CSS Gradient Bug

Making Static Noise From a Weird CSS Gradient Bug

What I will be doing here is kind of an experiment to explore tricks that leverage a bug with the way CSS gradients handle sub-pixel rendering to create a static noise effect — like you might see on a TV with no signal.

TATemani AfifTemani Afif·November 18, 2022Frontend
Frontend — CSS Grid and Custom Shapes, Part 3

CSS Grid and Custom Shapes, Part 3

After Part 1 and Part 2, I am back with a third article to explore more fancy shapes. Like the previous articles, we are going to combine CSS Grid with

TATemani AfifTemani Afif·November 11, 2022Frontend
Frontend — How I Made a Pure CSS Puzzle Game

How I Made a Pure CSS Puzzle Game

I recently discovered the joy of creating CSS-only games. It’s always fascinating how HTML and CSS are capable of handling the logic of an entire online game,

TATemani AfifTemani Afif·September 9, 2022Frontend
Frontend — CSS Grid and Custom Shapes, Part 2

CSS Grid and Custom Shapes, Part 2

Alright, so the last time we checked in, we were using CSS Grid and combining them with CSS clip-path and mask techniques to create grids with fancy shapes.

TATemani AfifTemani Afif·August 22, 2022Frontend
Frontend — CSS Grid and Custom Shapes, Part 1

CSS Grid and Custom Shapes, Part 1

In a previous article, I looked at CSS Grid's ability to create complex layouts using its auto-placement powers. I took that one step further in another

TATemani AfifTemani Afif·August 15, 2022Frontend
Frontend — Zooming Images in a Grid Layout

Zooming Images in a Grid Layout

Creating a grid of images is easy, thanks to CSS Grid. But making the grid do fancy things after the images have been placed can be tricky to pull off.

TATemani AfifTemani Afif·August 8, 2022Frontend
Architecture — Single Element Loaders: The Bars

Single Element Loaders: The Bars

We’ve looked at spinners. We’ve looked at dots. Now we’re going to tackle another common pattern for loaders: bars. And we’re going to do the same thing in

TATemani AfifTemani Afif·June 24, 2022Architecture
Frontend — Single Element Loaders: The Dots

Single Element Loaders: The Dots

In this second part of our four-part series, we will make a dot loader with only a single div element using CSS backgrounds and masks.

TATemani AfifTemani Afif·June 17, 2022Frontend