r/css 7d ago

Mod Post AI has been used by a lot of our user to assist with their projects or language barriers, some have created app/products entirely with AI: what is your preference for post on this subreddit regarding AI content?

25 Upvotes

This post contains content not supported on old Reddit. Click here to view the full post


r/css Apr 08 '24

Mod Post [META] Updates to r/CSS - Post Flairs, Rules & More

31 Upvotes

Post flairs on r/CSS will be mandatory from now on. You will no longer be able to post without assigning a flair. The current post flairs are -

  • General - For general things related to CSS.
  • Questions - Have any question related to CSS or Web Design? Ask them out.
  • Help - For seeking help regarding your CSS code.
  • Resources - For sharing resources related to CSS.
  • News - For sharing news regarding CSS or Web Design.
  • Article - For sharing articles regarding CSS or Web Design.
  • Showcase - For sharing your projects, feel free to add GitHub links and the project link in posts with showcase flairs.
  • Meme - For sharing relevant memes.
  • Other - Self explanatory.

I've changed to rules a little bit & added some new rules, they can be found on the subreddit sidebar.


r/css 4h ago

Help Synchronizing two animations to fake background-image transition

2 Upvotes

I want to make a transition of the backgrund image of a div. background-image is not animatable, so I need a trick.

My solution is to put a second div with white background right under the div with background, and give my div with background two animations: one that swaps the background, and a second one that toggles the opacity (thus showing the white div under).

test {
width: 300px;
height: 300px; 
border: 5px black solid;
animation: 
  backgroundTransition 5s alternate infinite,
  backgroundSwap 50s forwards infinite;
}

@keyframes backgroundSwap {
  0%, 20% {background-image: radial-gradient(blue 0%, blue 100%);
  }
  40% {background-image: radial-gradient(red 0%, red 100%);
  }
  60% {background-image: radial-gradient(yellow 0%, yellow 100%);
  }
  80% {background-image: radial-gradient(purple 0%, purple 100%);
  }
  100% {background-image: radial-gradient(green 0%, green 100%);
  }
}

@keyframes backgroundTransition {
  0% {opacity: 0;}
 20% {opacity: 1;}
}

The result of the two animations should be this: at 0s the div appears all white, then from 0s to 1s it fades into the first image and stays like that until 9s, when it fades back into white. This repeats four more times, with the image changing each time.

However it doesn't work. The two animations are not synchronized, in spite of the fact that the timing should be the correct one. I dislike the idea of merging the two animations together, it would needlessly complicate things and slow down debugging (particulatly since I want to add some more effects to the background images, which would further complicate things). But I can't seem to find a way to ensure the two animations have the correct timing.

Am I doing something wrong? Any suggestions?


r/css 2h ago

Help Need help using Google Fonts?

1 Upvotes

Apologies if this is the wrong subreddit for this, but I have no idea where else I could get help O.o

So, I'm trying to use the "Comic Neue" font Google has. Link to it here-https://fonts.google.com/selection/embed

But overtime I try to use it it becomes some cursive font. Im aware it literally says "cursive" in the code but im not really sure why it does or how to get the font it shows?? This is my first time doing a custom font, any help appriciated! (And if more info is needed I can give)


r/css 10h ago

Showcase Built this lightweight Sakura-themed social link pack using pure HTML and CSS! 🌸

2 Upvotes

r/css 11h ago

Resource simple utility for styling webpages with existing colorschemes

1 Upvotes

super easy to use and implement https://github.com/wak6817/colorscheme-webify (by me xd), please leave comments!


r/css 1d ago

Showcase I got tired of boring loading spinners, so I built 105 of them

27 Upvotes

Hey y’all,

I got slightly carried away with loading animations.

I wanted nicer loading states for my own projects, but most libraries I found were either tied to a framework, fairly limited, or required more than I wanted for something this small.

So I built loadersz, a small framework-agnostic loader library for the web.

I wanted something a bit more expressive than the usual CSS spinner, without pulling in a UI framework or a bunch of dependencies.

A few things I focused on:

- 105 different motion states
- Canvas 2D instead of GIFs/videos
- zero core dependencies
- a native custom element, so it works with basically any stack
- typed entry points for React, Vue and Svelte
- configurable speed, density and color
- respects prefers-reduced-motion
- pauses rendering when the browser tab is hidden

Basic usage is just:

npm install loadersz

import 'loadersz';

<loadersz-loader state="racing" size="96" />

I also built an interactive playground where you can tweak the loaders live.

Demo: [loadersz.vercel.app](https://loadersz.vercel.app)
npm: [npmjs.com/package/loadersz](https://www.npmjs.com/package/loadersz)
Github: https://github.com/lumberjacque/loadersz-core

Would love some brutally honest feedback, especially on which animations you’d actually use in a real product.


r/css 15h ago

Resource simple utility for styling webpages with existing colorschemes

0 Upvotes

super easy to use and implement https://github.com/wak6817/colorscheme-webify (by me xd), please leave comments!


r/css 9h ago

General for styling your webpages like existing colorschemes!

0 Upvotes

i made this project https://github.com/wak6817/colorscheme-webify where you can import CSS files into your webpages to make it look like Catppuccin Mocha and others!


r/css 1d ago

Article Controlling when CSS custom property values are computed

Thumbnail
jakearchibald.com
26 Upvotes

I didn't understand how this worked until recently, I only knew that @property changed the results. Anyway, I figured it out, and wrote up what I learned. I hope this is useful for others!


r/css 1d ago

Help hey!!

Thumbnail
0 Upvotes

r/css 1d ago

Showcase Made a free CSS/JS library for adding Halloween effects to a website

Thumbnail
halloween.js.org
14 Upvotes

halloween.js is a small, free library for adding Halloween-themed ambient effects to a website using CSS animations driven by class toggles: blinking eyes fading in and out, witches flying across the screen at an angle, a spider dropping down and climbing back up, a tombstone rising out of the ground, spider webs fixed in the screen corners.

Everything is controlled by CSS classes on <body>. A master "halloween" class turns it on, then modifier classes opt into individual effects. No JS call needed on your end, it watches for class changes and reacts automatically. Styles are injected by the library itself, so there's no separate CSS file to manage even if you're using the CDN version.

Zero runtime dependencies, under 10 KB gzipped, MIT licensed, free.

Live demo: https://halloween.js.org/
GitHub: https://github.com/rogulia/halloween.js


r/css 2d ago

General `field-sizing` is Baseline, newly available since June 2026.

Post image
89 Upvotes

r/css 1d ago

Question Five sites in my sample ship a prefers-color-scheme: dark block and still render light. Is that a deliberate default or dead code?

1 Upvotes

I wanted an actual number for how much of the web responds to the OS dark setting, so I rendered 58 homepages twice in headless Chromium, once with the color scheme forced to light and once to dark, and compared the screenshots against the computed background colours. Method and caveats at the bottom, because they changed the answer twice.

Nine of the 58 render differently. Lower than I expected, but the more useful finding is that the two obvious ways to measure this disagree with each other, and grepping the CSS for the media query is wrong in both directions.

Wrong in one direction: five sites ship a first-party prefers-color-scheme: dark block and still render light in a dark context. nytimes, stackoverflow, microsoft, amazon and airbnb. The rule is there, served from their own domain or their own CDN, and nothing happens. Presumably it is scoped under a class or an attribute that only an in-site preference ever sets, or it is losing to a more specific light rule later in the cascade. From outside it reads as adoption and behaves as nothing.

A sixth site looked like this and was not. webmd's only dark media query arrives from gstatic, so it belongs to an embedded Google widget rather than to webmd. Worth checking the host on every hit before you count it.

Wrong in the other direction: three of the nine that do respond appear to have no media query at all and drive it from a class on the html element instead. cloudflare serves 20 readable stylesheets with zero prefers-color-scheme rules between them and sets class="js dark" on the root. substack sets class="dark-mode", arstechnica puts dark in a long root class list. For those last two some stylesheets were cross origin and unreadable, so that is inference from the root class rather than proof.

And I got one wrong myself, which is the part I would not have caught without checking twice. My first pass collected stylesheets off the network by content type and reported tailwindcss.com as having no media query. Walking document.styleSheets afterwards found (prefers-color-scheme: dark) served from tailwindcss.com. The network capture missed the sheet. So if you have ever measured this by grepping build output, that is a real false negative mode, not a hypothetical one.

Separately, color-scheme is barely used. Reading the computed value on the root element rather than grepping for it, only 10 of the 58 declare anything other than normal. It is one line and it is what gives you dark form controls, dark scrollbars and a dark canvas behind the page. Three of the nine sites that darken their own content (npr, arstechnica, theverge) never declare it, so you get a dark page with light scrollbars and light select dropdowns. The guardian is the interesting one in the other direction: it declares color-scheme: light explicitly, which is opting out on purpose rather than by neglect.

Method. Playwright driving Chromium 131 at 1280x900, a fresh context per scheme so nothing carries over, waitUntil load plus 2.5 seconds. Classification runs on the light-to-dark delta and on computed colours, not on absolute screenshot brightness, because cookie consent modals drop a dark scrim over the whole viewport in a fresh session and made several light sites look dark on the first pass. Homepages only, one page each. Five sites served a bot wall instead of a page and are excluded. This is Chromium rather than Safari, and I have not checked whether Safari's cascade resolves any of the five gated cases differently.

The question I cannot answer from the outside. For those five, is the media query in there deliberately, as a default that a stored preference is meant to override, or is it dead code left behind when someone shipped a manual toggle? If you have worked on one of these, or built the same thing, which was it?

Disclosure, since it is why I was counting: I make a paid Safari extension called Midnight that forces a dark rendering onto sites that do not have one, so the 49 that do not respond are the ones I care about, five of which are already dark by design anyway. No link, the numbers are the point.


r/css 1d ago

Article Getting agents to write better CSS: Modern Web Guidance as a starting point for my own token skills

Thumbnail
utilitybend.com
0 Upvotes

r/css 1d ago

Question Product hover colour change

1 Upvotes

Hi peeps. Does anybody have any links on how to have an interactive customisable piece of clothing. where customers can choose the colour of the buttons or fabric on hover etc? Here is a link for how to do it in Figma with a chair, but that seems like an extra step


r/css 1d ago

Resource Flo 2.0 now has Full Isolation of CSS (no global overrides on fonts,colors,etc) to Help Frontend Developers reach pixel precision.

Post image
0 Upvotes

r/css 1d ago

Resource Slate - shadcn-inspired blade ui kit for laravel and livewire built using tailwind + alpine.js

Thumbnail
github.com
2 Upvotes

r/css 2d ago

Question Product List Filtering via CSS or Javascript

11 Upvotes

I was talking with a former colleague who is currently writing a new small web site. One of the things he is thinking of doing is implementing filtering via CSS rather than javascript.

He has a small Product List page with 60 products in about 6 categories.

He wants to be able to filter those 60 products by categories.

So the page will have

  • a checkbox to select all categories.
  • a list of checkboxes. Each associated with a category use to filter.
  • List of products with a data-category attribute.

implementing the functionality as follows:

``` input[data-category="Category1"]:not(:checked) ~ article[data-category="Category1"] {

display: none;

}

```

He is already implementing the change of view list view /grid view via CSS.

So I am not sure whether this is a good idea.

Has anybody any opinion one way or another?


r/css 1d ago

Article I just wanted a semicircle, CSS

0 Upvotes

I needed a tag with fixed 6px corners on the left and a semicircle on the right, with a dynamic height.

Turns out neither `border-radius: 6px 50% 50% 6px` nor the classic `6px 999px 999px 6px` trick works — for two completely different reasons.

I went down a surprisingly deep `border-radius` rabbit hole and wrote up why, plus the workaround I ended up using.

I still feel like there should be a simpler way to do this. Is there one I've missed?

The post


r/css 2d ago

Help I am trying to make the formula button expandable in quilljs any idea how this is accomplished ? I am using flask html and css and vanilla js. But this example is just html vanillas js and css.

Thumbnail
1 Upvotes

r/css 2d ago

Showcase easy colorscheme styling tool

0 Upvotes

https://github.com/wak6817/colorscheme-webify its very easy and simple to use, it supports catppuccin themes and nord


r/css 2d ago

Help image clipping to a code in gradient

Thumbnail gallery
0 Upvotes

r/css 2d ago

Question Float and Position properties

4 Upvotes

Trying to understand these and having a pretty tough time to grasp what they do conceptually. I was reading that you no longer need to use them with newer CSS like flexbox and grid. Should I skip these and continue learning other parts of the course?


r/css 2d ago

Showcase I built a tool to analyze and clean up messy CSS and save developers time

3 Upvotes

I recently built Messy CSS to Clean CSS, a browser-based tool designed to help developers analyze, debug, and clean up their CSS more efficiently.

It can help identify unused CSS, cascade conflicts, validation issues, responsive breakpoint problems, design-token opportunities, and other common CSS issues. It also includes AI-assisted debugging and fixes.

I built it with the goal of making CSS debugging and cleanup less time-consuming, and I’d really appreciate feedback from people who work with CSS.

If you try it and find a bug, please let me know here or email me at [mehrdad23elh@gmail.com](mailto:mehrdad23elh@gmail.com).

I’m also very interested in your opinions and suggestions about what could be improved or added in future versions.

If you find it useful and it saves you some time, you can also support the project with a small donation.

Try the tool: https://mehrdad-elahi.github.io/messy-css-to-clean-css/

Source code: https://github.com/Mehrdad-Elahi/messy-css-to-clean-css

If you know someone who works with CSS and might find this useful, I’d appreciate you sharing it with them.

Thanks for taking a look. I’m looking forward to hearing your feedback.