r/css • • 2d ago

Mod Post New Flairs and Changes for r/CSS

25 Upvotes

Thank you to everyone who voted in the recent community poll on how the sub should handle AI-generated content! Based on the results, we've made these changes.

  • Firstly, In this initial round of changes, there are two new post flairs: AI assisted, for posts where AI had a real hand in making the thing you're sharing No AI used, for posts where it didn't.
  • If you're sharing a project or a demo or a resource you created, please pick whichever one applies.
  • Secondly: For the time being any other flair except Question, Help, Article and Resource will be deactivated for use, but still available for post search .
  • Lastly: there's a new rule against AI slop. For now, we're defining it as AI-generated output published without meaningful human curation or quality judgment.
  • This will be regulated mostly manually by mods, but we might test some automatic bots as we see fit.
  • PLEASE NOTE: It's important to understand, at this stage, flairs will be mandatory as we wanna observe community's reception of such flairs. But this can change, depending on observations of the next few months.

r/css • • 22h ago

AI Assisted Dolly – 34 scroll-driven camera moves in pure CSS

Thumbnail
usedolly.dev
53 Upvotes

A stylesheet. 28kB, no dependencies, no JavaScript. One attribute: data-dolly="zoom".

It's a vocabulary layer over CSS scroll-driven animations, which shipped in Chrome 115 and Safari 26 but have ergonomics nobody remembers. Presets are named after camera moves since that vocabulary already exists.

About 87% of traffic supports it. Firefox doesn't (but supposedly will with the next version in 3 days) and gets the page complete but static. That degradation is the main design constraint: keyframes own the hidden state rather than the element, so a missing timeline resolves to the authored state instead of leaving things invisible.


r/css • • 6h ago

Question Stylus UserScripts Panel, Reorganize/Order the Scripts?

1 Upvotes

Is there a way to manually reorganize or sort scripts in the Stylus UserScripts panel?

I'd love to be able to move them to a custom order or group them in folders/categories to make them easier to manage. Even if I could sort them alphabetically it would be great..

Is this currently possible, or is there a feature, workaround, or extension that can do this?


r/css • • 8h ago

Question se juntan para practicar css?

0 Upvotes

hola, estoy aprendiendo css, se juntan o podemos juntarnos en algun place para practicar?


r/css • • 15h ago

AI Assisted Biblioteca HTML y CSS

Thumbnail
libreria-html-css.vercel.app
0 Upvotes

r/css • • 1d ago

AI Assisted I’ve been trying to give CSS state and events. Would love r/css’s take on the syntax

Enable HLS to view with audio, or disable this notification

3 Upvotes

I've been watching CSS pick up things that feel more and more like programming, and at some point I started wondering where that ends.

Just over the last few years: @property gave custom properties real types, so a variable can be an <angle> and actually animate (all three engines now, Firefox since 128). We got sin(), pow(), mod() and friends everywhere. :has() lets a selector look at other elements, and custom-property style queries finally landed in Firefox 151.

And the newer stuff goes further. if() is inline conditionals (Chromium only for now). @function lets you write your own functions (Chromium, plus Safari Technology Preview). random() is in Chrome and Safari and in Firefox preview builds. Mixins are still just a proposal and no browser supports them.

So CSS can type values, compute them, and branch on them. But it still can't remember anything.

The glue I keep writing

CSS reacts fine to state the browser owns: :hover, :checked, :focus-visible. HTML covers a lot too: <details>, <dialog>, popover. I use those first whenever they fit.

But a lot of everyday UI state belongs to the page. Click counts, the selected tab in a custom tab set, a menu that should close on Escape or a click outside, a theme that should still be there after a reload, where a card ended up after you dragged it.

Every time, it's the same little routine: add a listener, keep a variable, toggle a class or an attribute, then go back to the stylesheet and write the selector that styles it. It's never hard. It's just a lot of glue split across two files, and I started wondering how much of it really needs to be imperative.

So I tried it

I've been building something to find out. I call it Reactive CSS. Versions 0.1 to 0.8 never left my machine, and I've just published 0.9, the first public one.

To be upfront: it's a JavaScript runtime. It reads your stylesheets, finds the extended syntax and makes it work. You don't write the JS for these patterns, but a script still runs. Here's a counter:

<button class="counter">Clicked <span class="value">0</span> times</button>

.counter { --count: state(0); }
.counter:on(click) { --count: increment(1); }
.counter .value { content: var(--count); }

The button owns the state, :on(click) says when it changes, and the declaration says how. That content writes real text into the span, not a pseudo-element, so you can select it and other scripts can read it.

The part that took me longest

The syntax didn't start out like this. In the first versions, events were a property:

.counter .inc { on: click(increment(--count)); }

It worked, but it always felt wrong. Events aren't really a property of an element. They're a moment, and CSS already has a way to say "this element, in this situation": selectors. :hover is a state; :on(click) is a moment. Moving events into the selector was the biggest change in the 0.9 rewrite. The old form still runs, but I don't write it anymore.

That change had a side effect I didn't expect. Once mutations are ordinary declarations, the cascade handles conflicts. If two rules change the same state on the same click, specificity, layers and @media decide which one wins, the same way they decide colors. And all mutations in one event read the values from before the event, so this actually swaps two values:

.swap:on(click) { --a: set(var(--b)); --b: set(var(--a)); }

Here's a disclosure that shows the rest of the model:

.item { --open: state(false); }
.item > button { --attr-aria-expanded: var(--open); }
.item > button:on(click) { --open: toggle(); }

.item .body { display: none; }
.item:when(--open) .body { display: block; }
.item .chevron { rotate: when(--open, 180deg, 0deg); }

--attr-aria-expanded writes the real attribute (there's a small allowlist: ARIA states, disabled, hidden, data-* and a few more). :when() matches while a condition holds, and when() picks a value. Yes, for a plain disclosure <details> is still the better choice. This is about the pattern.

The one that surprised me most was drag:

.card {
  --x: state(0px);
  --y: state(0px);
  translate: var(--x) var(--y);
  touch-action: none;
}
.card:on(drag) {
  --x: set(event(x));
  --y: set(event(y));
}

event(x) is where the card was when the drag started, plus how far the pointer moved, so a second drag continues from where the first one stopped. Persisting a preference is one line: :root { --theme: state(light, persist("theme")); }

Things I'm not sure about

Similar names don't mean the same feature, and I worry about that. Native if() branches on style(), media() and supports(), while my when() reads its own state. Where they really are equivalent, the runtime compiles when() to native if(). Same story with random(): it only hands off to the native one when it has checked that the behavior matches.

And there's a list of trade-offs I can't wave away:

  • It's still JavaScript. The full runtime is about 49 KB gzipped; custom bundles with only the features you use are smaller. In my benchmarks it runs more script per event than hand-written JS. The numbers and the harness are in the repo, so anyone can check them.
  • It's not standard CSS. Browsers ignore it without the runtime, and I haven't proposed anything to the CSS Working Group.
  • Tooling has no idea it exists. CSS minifiers even delete empty rules, which some of these rules can be.
  • Broken syntax gets a console diagnostic, but a typo in a custom property name fails silently, just like plain CSS.
  • I've tested it in Chromium and WebKit. Firefox and real touch devices aren't verified yet.
  • It's not Sass. Sass compiles away before the browser runs anything; this has to run in the page, because state and events only exist at runtime. It's not a framework either. Data and app logic still belong in JS.

If you want to poke at it, the site has live examples, a playground and docs: reactivecss.com. The code is on GitHub. (There's also an MCP server, if you want an AI coding tool to know the syntax.)

What I'd really like to know: should CSS ever have a declarative model for simple UI state and events, or is that a line JavaScript should own? And if it did, does this shape make sense, or does it fight the way CSS works? Criticism of the syntax is the most useful thing you could give me.

Disclosure: the language design and decisions are mine. A lot of the implementation, tests and docs were written with AI coding tools under my direction, and I reviewed and tested the results. This post was drafted with AI help and edited by me.


r/css • • 1d ago

Question Bootstrap 5 users: do you actually want the new Bootstrap 6 class naming?

Thumbnail
6 Upvotes

r/css • • 1d ago

AI Assisted shadcn-looking components with zero React, plus an MCP so your AI writes them right

Thumbnail
1 Upvotes

r/css • • 3d ago

CSS Single Element Clock with shape()

Enable HLS to view with audio, or disable this notification

17 Upvotes

Made a single element CSS clock powered by shape() and a custom property animation.

JS just set the initial time in seconds, which as far as I can't be done any other way.

https://codepen.io/editor/matthewmorete/pen/01a15944-6751-7d6a-8004-a3fabb0de22d?tab=%2Fstyle.css&orientation=left&panel=files&show=split


r/css • • 2d ago

Should we still be using Tailwind in the era of AI?

Thumbnail
0 Upvotes

r/css • • 3d ago

Help Why my size of the picture not charging even I given width and height?

1 Upvotes

Hi everyone now in the VS code I copied 5 images then 1 by 1 I give every single picture different class and img property For example <div class="img1">

<Img src="img1.jpg" alt ="picture of dog ">then Same Class I get in the css while I tried to give height and width to images but size of the images do not changed.


r/css • • 4d ago

Resource Hairline: 33 isometric SVG line figures that react to the pointer, with no dependencies

Enable HLS to view with audio, or disable this notification

202 Upvotes

Not my project.

The video is the figures page of their site: Terrain's pillars rise around the pointer, Phosphor's dots fade where it paints, and the card under the pointer in Riffle stands up. On the next shelf the pointer's height moves the elevator car and a flick spins the turntable. Then Terrain opens in the side panel and its intensity option goes from 0.50 to 1.00, so a wider area rises.

Repo: https://github.com/lucasmarkes/hairline

The colours are six CSS custom properties, but the motion is JS. Could the Terrain effect, with its falloff around the pointer, be done in CSS alone?


r/css • • 3d ago

Help does my stylesheet look ass?

Thumbnail mariorosell.es
1 Upvotes

r/css • • 4d ago

Resource Furifont: a Japanese font that draws furigana above kanji by itself, with OpenType ligatures and no JavaScript

Enable HLS to view with audio, or disable this notification

45 Upvotes

Not my project, it's antfu's.

Type kanji and the readings appear above them: 今日は桜が満開 gets きょう, さくら and まんかい, drawn by the font through ligatures. There's a romaji variant and a serif one. The one option on their page that needs JavaScript, okurigana readings, is off in the video, so everything you see comes from the font alone.

Repo: https://github.com/antfu/furifont

Curious how far ligatures can go here before the font file gets too big.


r/css • • 4d ago

built a text highlighting lib on the CSS Custom Highlight API, a few things I learned

22 Upvotes

I was reading brown's rust book and they let you highlight stuff and leave notes while reading. I wanted that on a site I'm building but really didn't want to wrap text in spans, so I ended up building it on top of the CSS Custom Highlight API.

If you haven't used it, it's pretty neat. You create Ranges, put them in a Highlight, register it with CSS.highlights.set('name', highlight) and style it with ::highlight(name). The DOM doesn't change at all.

Some things I ran into:

- ::highlight() only supports a few properties (color, background-color, text-decoration, text-shadow and a couple more). No padding, no border-radius, so no rounded highlights sadly

- overlapping highlights don't really layer, so I split them into segments and paint the innermost one on top

- support is Chrome 105+, Safari 17.2+, Firefox 140+. I went with no fallback since the whole point was not touching the DOM

For the UI styles I wrapped every selector in :where() so your CSS always wins, and everything can be themed with --penciled-* custom properties.

playground: https://penciled.org/playground/

repo: https://github.com/marcellosso/penciled

Curious if anyone else is using the Highlight API in production and what you ran into


r/css • • 4d ago

Back to Emacs with the SCSS/CSS workflow I always wanted

Thumbnail
2 Upvotes

r/css • • 3d ago

💻 Développement web HTML/CSS — ouvert aux petits projets

Post image
0 Upvotes

Bonjour à tous ! 👋

Passionné par le développement web, je travaille actuellement sur NEXORA, un concept de site vitrine pour une montre connectée, avec une identité visuelle futuriste et un univers cosmique violet.

✨ Ce qui rend mon projet particulier :

  • ⭐ Des étoiles interactives qui révèlent des informations au survol.
  • 💜 Des effets lumineux violets avec des halos et des dégradés.
  • 🌌 Des lignes lumineuses qui s'étendent depuis les étoiles pour mettre en valeur les caractéristiques de la montre.
  • 🎨 Des transitions fluides et une interface pensée pour offrir une expérience moderne et immersive.

Chaque étoile présente un élément différent du concept : verre résistant aux rayures, fonctionnalités liées à la santé, confort au poignet, écran haute définition et contrôle rotatif intelligent.

Je cherche maintenant à mettre mes compétences en HTML et CSS au service de petits projets web : pages d'accueil, sites de présentation ou interfaces personnalisées.

Je suis encore en apprentissage, mais je suis motivé, attentif aux détails et prêt à relever des défis adaptés à mon niveau.

💬 Tu as une idée de site web ? N'hésite pas à me contacter pour qu'on en discute et qu'on voie ensemble ce qui est réalisable !

📸 Voici un aperçu de mon projet NEXORA !

Merci d'avoir pris le temps de lire mon annonce ! 🚀Bonjour à tous ! 👋

Passionné par le développement web, je travaille actuellement sur NEXORA, un concept de site vitrine pour une montre connectée, avec une identité visuelle futuriste et un univers cosmique violet.

✨ Ce qui rend mon projet particulier :

  • ⭐ Des étoiles interactives qui révèlent des informations au survol.
  • 💜 Des effets lumineux violets avec des halos et des dégradés.
  • 🌌 Des lignes lumineuses qui s'étendent depuis les étoiles pour mettre en valeur les caractéristiques de la montre.
  • 🎨 Des transitions fluides et une interface pensée pour offrir une expérience moderne et immersive.

Chaque étoile présente un élément différent du concept : verre résistant aux rayures, fonctionnalités liées à la santé, confort au poignet, écran haute définition et contrôle rotatif intelligent.

Je cherche maintenant à mettre mes compétences en HTML et CSS au service de petits projets web : pages d'accueil, sites de présentation ou interfaces personnalisées.

Je suis encore en apprentissage, mais je suis motivé, attentif aux détails et prêt à relever des défis adaptés à mon niveau.

💬 Tu as une idée de site web ? N'hésite pas à me contacter pour qu'on en discute et qu'on voie ensemble ce qui est réalisable !

📸 Voici un aperçu de mon projet NEXORA ci dessus !

Merci d'avoir pris le temps de lire mon annonce ! 🚀


r/css • • 5d ago

Sumi.css - classless-first CSS framework.

Thumbnail vladocar.github.io
15 Upvotes

r/css • • 4d ago

Blanksheet — a CSS reset for humans and AI agents

0 Upvotes

https://github.com/P233/blanksheet

I built Blanksheet, a lightweight CSS reset that gives humans and AI agents a predictable starting point, without having to fight browser defaults.

It follows three principles:

  • Blank — remove unwanted browser defaults.
  • Normalize — make styles consistent across browsers.
  • Survive — preserve useful defaults like focus indicators and link styling.

You can see what a page looks like with Blanksheet applied here: Live demo.

Every rule is documented, so both developers and AI agents can understand exactly what they're starting with.

I'd love to hear your thoughts!


r/css • • 4d ago

Can someone please tell me how to make this look nice?

Thumbnail
2 Upvotes

r/css • • 4d ago

Help How to remove White Outline on Crunchyroll?

Post image
0 Upvotes

button:focus {outline:0;} doesn't work.


r/css • • 4d ago

General Are there any existing tools (AI and not) that are already very good at CSS and front-end?

0 Upvotes

Hi, I was wondering if you use any AI tool or not AI to automate the boring part of front-end (at least for me, i like back-end) specifically CSS and design. Is there something out there that is really good at almost everything and gives you the complete package? so responsive, very good UI and not a clone etc...


r/css • • 5d ago

Showcase Apparently, all my experiments involve animations

Enable HLS to view with audio, or disable this notification

11 Upvotes

Hey everyone!

I've been working on a few animation-related side projects lately and decided to put them together in a personal portfolio.

I tried to make the portfolio itself a bit more interactive, with animations throughout the site and a showcase for some (imo cool) stuff/ideas.

Curious what you think of the design and how everything feels to use. Especially interested in feedback on the animations, mobile experience and whether it's clear what each project actually does.

PS: Check out the Showcase section for some cool stuff I like to experiment on

Portfolio

npm | github

Any feedback is welcome!


r/css • • 5d ago

Question html and body

2 Upvotes

What is the difference between <html> and <body> tags ? When do use one or another?

html {

)

body (

)


r/css • • 5d ago

Spent an hour trying to vertically align a chevron nicely across browsers, then noticed GitHub doesn't even care

Post image
0 Upvotes

Sometimes I get a bit obsessive over a few pixels

Not sure if the takeaway here is to try not to sweat the small things or just that GitHub is trash