CSS by T. Afif

@css-only.dev

CSS stuff by Temani Afif (https://support.temani-afif.com) 💡 https://css-tip.com 🧩 https://css-shape.com 💫 https://css-loaders.com 📝 https://css-articles.com ⚙️ https://css-generators.com 🧱 https://css-pattern.com 🎨 https://css-only.art

An now, for my next trick, we will answer the CSS questions everyone had for years: how to center horizontally. Like, really, 100 different ways. Some are quite hacky, but, still, fun to explore just to test the limits of CSS, hehe Tool made by @css-only.dev css-generators.com/center/

How to center an element horizontally and vertically

100 different ways to center a single element horizontally and vertically inside a container.

css-generators.com

📝 New CSS Article! I wrote about border-shape. A super powerful feature! You might think I'm exaggerating but I am not. css-tricks.com/get-ready-fo... This is just a tiny overview of its potential. Stay tuned for more articles/demos that will blow your mind (I am still not exaggerating!)

Get Ready For the Powerful CSS border-shape Property!

We recently got the shape() function and corner-shape property. What else could we possibly need as far as making shapes in CSS? Let me tell you: the border-shape property!

css-tricks.com

📝 New CSS Article! I wrote about border-shape. A super powerful feature! You might think I'm exaggerating but I am not. css-tricks.com/get-ready-fo... This is just a tiny overview of its potential. Stay tuned for more articles/demos that will blow your mind (I am still not exaggerating!)

Get Ready For the Powerful CSS border-shape Property!

We recently got the shape() function and corner-shape property. What else could we possibly need as far as making shapes in CSS? Let me tell you: the border-shape property!

css-tricks.com

Modern CSS is so cool. The only properties here that existed 20 years ago are width and border. Going back in time and showing this to a front-end developer in 2006 would be the equivalent of a medieval peasant tasting Doritos.

.container > * {
  grid-area: 1/1;
  width: var(--s);
  aspect-ratio: 1;
  border-radius: 10px;
  border: 2px solid;
  box-sizing: border-box;
  --n: round(down,(100cqw + var(--g))/(var(--s) + var(--g)));
  --i: round(down,(sibling-index() - 1)/var(--n));
  --j: mod(sibling-index() - 1,var(--n));
  translate: calc(var(--j)*(100% + var(--g))) calc(var(--i)*(100% + var(--g)));
  transition: .4s,scale .3s .4s,opacity .3s .3s,rotate .3s .3s;
  @starting-style {
    scale: 0;
    opacity: 0;
    rotate: -1turn;
  }
}
CSS by T. Afif@css-only.dev · 4w ago

Here is my idea of the animated Grid layout No View Transitions, No JS, and no Anchor Positioning. You get an animation on resize and when adding/removing new items. css-tip.com/animated-grid/

Here is my idea of the animated Grid layout No View Transitions, No JS, and no Anchor Positioning. You get an animation on resize and when adding/removing new items. css-tip.com/animated-grid/

Bramus@bram.us · 2mo ago

New demo: Animated CSS Grid Layout. codepen.io/bramus/pen/o... Here’s the thing: No View Transitions. No JS at all. Instead, it uses Anchor Positioning to anchor the cell contents to the cell. Then, CSS transitions are used to animate the contents to their new location as the grid re-layouts.

And guess what? You can combine border-area with text, and you get the gradient on both the border and the text! 👀 css-tip.com/background-c... Yes, two values for background-clip.

Overview of the CSS code from the linked postAn element having text and gradient border.
CSS by T. Afif@css-only.dev · last mo.

They just released @developer.chrome.com V150, and it comes with border-area (among many other cool things). What's border-area? The magic value to create gradient borders easily. css-tip.com/border-gradi... Two lines of code and you are done! 🤩

Overview of the CSS code from the linked post

I proposed this feature in 2023. Safari implemented in 2024. Chrome just shipped it too. This means that it's now a matter of time before it’s available for >88% of web users. Timeline: lea.verou.me/specs/#conti... “But standards are so slow!”

CSS by T. Afif@css-only.dev · last mo.

They just released @developer.chrome.com V150, and it comes with border-area (among many other cool things). What's border-area? The magic value to create gradient borders easily. css-tip.com/border-gradi... Two lines of code and you are done! 🤩

Overview of the CSS code from the linked post

And guess what? You can combine border-area with text, and you get the gradient on both the border and the text! 👀 css-tip.com/background-c... Yes, two values for background-clip.

Overview of the CSS code from the linked postAn element having text and gradient border.
CSS by T. Afif@css-only.dev · last mo.

They just released @developer.chrome.com V150, and it comes with border-area (among many other cool things). What's border-area? The magic value to create gradient borders easily. css-tip.com/border-gradi... Two lines of code and you are done! 🤩

Overview of the CSS code from the linked post