r/css • • Oct 23 '26

Mod Post New Flairs and Changes for r/CSS

27 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 • • 10h ago

Question Anyone up for a small HTML/CSS task as a first open source contribution?

3 Upvotes

Hey, I have a small open source project with a static web page and I opened an issue that I think could be a good first PR for someone. It's adding a short info block to the page. The text is already written, so the work is the HTML/CSS: making it fit the existing style (fonts, colors) and look good on a phone at 390px.

Would anyone here be interested?

https://github.com/eoSalinas/prensa/issues/62


r/css • • 15h ago

AI Assisted I built a lightweight, animated SVG circuit-board background (no canvas, auto dark/light theme)

Thumbnail
github.com
2 Upvotes

Demo: https://tkdeng.github.io/web-circuit-background/

I wanted a subtle circuit-board background for web projects without relying on <canvas> or heavy libraries, so I put together this small drop-in script and stylesheet.

On page load, it generates a random layout of non-crossing traces with occasional electron pulses flowing through them, plus a live loading-state toggle (CircuitBackground.setLoad(5)) to speed up activity when needed. It also adapts automatically to light/dark themes, supports accent tinting with --circuit-color, and respects prefers-reduced-motion.


r/css • • 1d ago

Question Do you use CSS Container Queries for reusable components, or still rely mostly on media queries?

Thumbnail reddit.com
3 Upvotes

r/css • • 16h ago

No AI used Just want to share

0 Upvotes

AI assisted mostly for JavaScript not for CSS.

Somewhere in the beginning of this year I decided to relearn modern CSS. It’s a hobby of mine to make websites. I have been using bootstrap since version 3 I think. So, I find a lot of changes has taken place.

I took time to relearn as I am not a fast learner anymore. So far I had a very firm understanding of grid and flexbox. Another new favourite function is clamp. Recently discovered oklch color format (coming from something like web-safe colors) it’s overwhelming but I grasped the basic of it.

So far I have ported my personal blog to my own CSS and there is still a lot of work to do. I have yet to do light/dark theme on it.

Now, I want to share a side project that I build earlier just for fun in bootstrap but now rewrote the CSS, JS I did the earlier work but as I am not well versed with JS so I use Gemini to achieve what I wanted. I use flex and grid a lot and I think this side project is a good way to do grid. Also used clamp for font-size and even height/width too and gap.

So, far I am happy with it. Below is my link

https://hs.fdh.pw/


r/css • • 1d ago

Article Dynamic table of content with one line of CSS

18 Upvotes

ol {

scroll-target-group: auto;

}


r/css • • 1d ago

Question adding a hanger to my website

Thumbnail gallery
0 Upvotes

r/css • • 1d ago

No AI used Using animation-timeline: scroll() for stickiness while scrolling inside SVGs

3 Upvotes

I had occasion to utilise an .svg file as a comic strip viewer, with the panels being a vertical strip to scroll through, and I wanted buttons for: a) restarting the UI-less slideshow, and b) going to a grid overview of all the panels.

I originally just made nine copies of the same two buttons, positioning each at the "same" point at the bottom of each panel, but then I saw that animation-timeline: scroll() recently landed in all browsers so decided to give that a go.

No critiques of the comic itself please, it's not mine:

https://imglink.cc/cdn/RLSQglSGwy.svg#p1

SVG <defs>:

<text id="rst">↻</text><text id="idx">📇</text>

SVG Content:

<g id="hud">
  <a href="#slide" aria-label="Restart SLIDESHOW"><use href="#rst" x="5" y="680"/></a>
  <a href="#Nav" aria-label="Go to OVERVIEW"><use href="#idx" x="326.5" y="677"/></a>
</g>

CSS:

@supports (animation-timeline: scroll()){
  :root:has(image:target) #hud,:root:has(rect:target) #hud{
    animation:hud-pin 1s linear both;animation-timeline:scroll(root block)
  }
  @keyframes hud-pin{0%{transform:translateY(0px)}100%{transform:translateY(5504px)}}
}

r/css • • 2d ago

Question How to choose color palette

7 Upvotes

I have just come across the light-dark() function and experimented with it. Now I realise color choice became limited, especially pairing light-dark part.

Does using light-dark scheme limit colour choice? I would love to know if there is any better scheme generator tool out there to experiment. I currently use colorffy.


r/css • • 1d ago

AI Assisted Eight visual themes on the same markup, done entirely with CSS variables

0 Upvotes

I've been building VinUI, an open-source component library. The main idea is that switching the whole look of a site should only mean swapping CSS variables.

It has eight styles: Precision, Tactile, Clay, Tonal, Editorial, Terminal, Paper and Bento. Every component keeps the same HTML and class names across all of them. Each style is just a set of custom properties, and accent colour, radius, font and density are variables on top. So one button can go from flat and minimal to soft clay-like depth to a monospace terminal look without changing a single tag.

Other CSS details:

  • Ships its own small CSS files, so it can sit alongside Tailwind or your own styles
  • Charts are plain SVG
  • Each component checked against WCAG 2.2 AA contrast in all eight styles, in light and dark

Repo: https://github.com/devvinish/vin-ui
Docs and live style switcher: https://vinish.dev/ui


r/css • • 2d ago

Question I've been learning SCSS for about 3 days. I'm trying to integrate a mixin from a partial I dedicated to media-query responsiveness. My media query styles aren't applying. I have a feeling it's because of how I'm calling the mixin. Could anyone see what's wrong with my code?

Thumbnail reddit.com
1 Upvotes

r/css • • 2d ago

AI Assisted A phone layout checklist from adding mobile support to our web app (CSS + a tiny keyboard-height script, tested)

0 Upvotes

We're building an AI study tutor, and this week we gave its notebook a phone layout. These are the rules that mattered most. The CSS and a small script are in a Gist.

  • Text fields at 16px or more. iOS Safari zooms the page when you tap into anything smaller.
  • Touch targets around 44px.
  • viewport-fit=cover, then pad bottom bars with env(safe-area-inset-bottom) so the home indicator doesn't sit on top of your buttons.
  • Nothing important only on hover. Phones have no hover, so anything that appears on hover has to be always visible there.
  • A bar that follows the keyboard. The keyboard covers the page instead of shrinking it, so a small script reads visualViewport and keeps a --kb CSS variable equal to the keyboard height.
  • Menus as bottom sheets, not popovers.
  • Cut what a thumb can't do. We dropped drag-to-reorder, multi-select and the resizable split on phones and added Move up / Move down instead. Our block menu opens from a button rather than a long-press, because long-press fights text selection on iOS.

The Gist has the CSS, the script, six tests for it, and a demo page that checks itself at phone width: https://gist.github.com/c68ad12186343d94581403176200c077

Caveat: we've tested it in desktop Chrome at phone width, not on a real device yet.

The tutor we're building: https://www.aiadaptivetutor.com

What's on your own phone checklist that we're missing?


r/css • • 4d ago

Question I use display: flex for almost everything. Am I missing out on something?

64 Upvotes

It's been a year since I started learning HTML, CSS, JavaScript, and web design and development in general. I build websites for my friends' small businesses, as well as personal projects.

Here's the thing: every time I want to center something, I go:

div {
    display: flex;
    justify-content: center;
    align-items: center;
}

I feel like I'm relying on Flexbox way too much. What other CSS layout techniques should I be using?


r/css • • 3d ago

Question I created an interactive preview of 11 animated mobile navigation styles

Thumbnail sofmik.github.io
0 Upvotes

I built an interactive demo where you can explore different animated mobile menu styles in one place. You can switch between them right in the interface and see how they work.

Try the demo: https://sofmik.github.io/animated-mobile-navigation-demo/

There are 11 styles in the full collection, seven of which are available to try in the demo.

I also offer the full package with the HTML, CSS, and JavaScript source files. The code doesn't rely on any specific framework and can be adapted for personal or client projects, although some extra work may be needed to integrate it into an existing website.

I think it could be useful both as code to adapt for your own projects and as a way to show clients different mobile navigation options.

Would a tool like this be useful in your workflow, either for showing options to clients or as a starting point for development? Why or why not?


r/css • • 4d ago

Question how to add decorative css border to an image in an image gallery?

Post image
2 Upvotes

r/css • • 4d ago

No AI used light-dark ()

4 Upvotes

Why didn’t I know about this earlier. It’s such a nice way to achieve light/dark mode.

I just re-build my link list site using this function. Also generated color schemes at colorffy.

fdh.pw


r/css • • 4d ago

Help CSS background from image asset

Post image
0 Upvotes

I feel like my issue is a Programiz problem, but I thought I could get more visibility by cross posting.


r/css • • 5d ago

Question Do you prefer CSS logical properties or traditional physical properties?

24 Upvotes

I'm currently learning CSS through Kevin Powell's CSS Demystified course, and one thing the lessons strongly encourage is using logical properties instead of traditional physical properties.

For example, using margin-inline instead of margin-left and margin-right, or padding-block instead of padding-top and padding-bottom.

I understand the reasoning behind logical properties, especially when it comes to supporting different writing modes and languages. However, I personally find physical properties more intuitive since that's what I've been using for so long.

I'm curious about what other developers actually use in their day-to-day work.

  • Do you exclusively use logical properties?
  • Do you still prefer physical properties?
  • Do you use a combination of both?
  • Is it worth making the switch even if you're primarily building websites for languages that use left-to-right writing directions?

I'd like to hear your opinions and experiences, especially from developers who have been working with CSS professionally for a while.


r/css • • 4d ago

No AI used Is it crucial to learn CSS nowadays or someone starting could learn tailwind directly?

Post image
0 Upvotes

r/css • • 5d ago

Help How do I get something above a fixed nav bar to be a layer above the nav bar?

0 Upvotes

I want the "Currently selected: First_select" to remain there as I scroll through the nav bar.

I've tried to use a div, but when I make it "position:fixed" it vaporizes. The only way I can think of it going under the nav bar is that I have it set to height 100%.

How I currently have it set up in the screenshot above is that I have it as a header under <nav>, but it scrolls with the nav bar which I do not want. With the div it looks like this:

Which breaks the scroll on the nav bar and breaks the text to the right.

Here is the code without the div:

<!DOCTYPE html>
<html lang="en">

<style>

.navbar ul{
  list-style-type: none;
  margin: -8px;
  padding: 0;
  width: 260px;
  height: 100%;
  position:fixed;
  background-color: #313031;
  text-align: center;
  border: 1px solid #555555;
  overflow: auto;
 
}
.navbar a {
  display: block;
  color: white;
  padding: 8px 16px;
  font-size: 20px;
  text-decoration: none;
}
.navbar a:hover {
background-color: #545254;
color: white;
}

</style>
</head>

<body>
<div>

</div>
<nav class="navbar">
<ul>

<h1 style="text-align: center;font-size: large; color: #f0f0f0; font-family: 'Lucida Sans', 'Lucida Sans Regular', 'Lucida Grande', 'Lucida Sans Unicode', Geneva, Verdana, sans-serif;">
Currently Selected:
</h1>
<h2 style="text-align: center;font-size: large; color: #67a92b;font-family: 'Lucida Sans', 'Lucida Sans Regular', 'Lucida Grande', 'Lucida Sans Unicode', Geneva, Verdana, sans-serif;text-decoration: underline;">
First_select
</h2>

<li style="text-align: center; border-bottom: 2px solid black; border-top: 2px solid black;background-color: #545254;"><a href="index.html">home</a></li>
<li style="text-align: center; border-bottom: 2px solid black;"><a href="First_select.html">Misc</a></li>
<li style="text-align: center; border-bottom: 2px solid black;"><a href="Second_select.html">Misc</a></li>
<li style="text-align: center; border-bottom: 2px solid black;"><a href="Third_select.html">Misc</a></li>
<li style="text-align: center; border-bottom: 2px solid black;"><a href="Fourth_select.html">Misc</a></li>
<li style="text-align: center; border-bottom: 2px solid black;"><a href="Fith_select.html">Misc</a></li>
<li style="text-align: center; border-bottom: 2px solid black;"><a href="Sixth_select.html">Misc</a></li>
<li style="text-align: center; border-bottom: 2px solid black;"><a href="Seventh_select.html">Misc</a></li>
<li style="text-align: center; border-bottom: 2px solid black;"><a href="Eighth_select.html">Misc</a></li>
<li style="text-align: center; border-bottom: 2px solid black;"><a href="Nith_select.html">Misc</a></li>
<li style="text-align: center; border-bottom: 2px solid black;"><a href="Tenth_select.html">Misc</a></li>
<li style="text-align: center; border-bottom: 2px solid black;"><a href="Elventh_select.html">Misc</a></li>
<li style="text-align: center; border-bottom: 2px solid black;"><a href="Twelth_select.html">Misc</a></li>
<li style="text-align: center; border-bottom: 2px solid black;"><a href="Thirteenth_select.html">Misc</a></li>
</ul>
</nav>

<div style="margin-left:242px;padding:1px 16px;height:1000px;">
  <article>    
Lorem ipsum dolor sit amet consectetur adipisicing elit. Enim sint vel impedit minima sapiente, tempore ut minus obcaecati mollitia modi quod perferendis. Perspiciatis maxime natus amet accusantium sunt labore praesentium.
</article>

</body>
</html><!DOCTYPE html>
<html lang="en">

<style>

.navbar ul{
  list-style-type: none;
  margin: -8px;
  padding: 0;
  width: 260px;
  height: 100%;
  position:fixed;
  background-color: #313031;
  text-align: center;
  border: 1px solid #555555;
  overflow: auto;
 
}
.navbar a {
  display: block;
  color: white;
  padding: 8px 16px;
  font-size: 20px;
  text-decoration: none;
}
.navbar a:hover {
background-color: #545254;
color: white;
}

</style>
</head>

<body>
<div>

</div>
<nav class="navbar">
<ul>

<h1 style="text-align: center;font-size: large; color: #f0f0f0; font-family: 'Lucida Sans', 'Lucida Sans Regular', 'Lucida Grande', 'Lucida Sans Unicode', Geneva, Verdana, sans-serif;">
Currently Selected:
</h1>
<h2 style="text-align: center;font-size: large; color: #67a92b;font-family: 'Lucida Sans', 'Lucida Sans Regular', 'Lucida Grande', 'Lucida Sans Unicode', Geneva, Verdana, sans-serif;text-decoration: underline;">
First_select
</h2>

<li style="text-align: center; border-bottom: 2px solid black; border-top: 2px solid black;background-color: #545254;"><a href="index.html">home</a></li>
<li style="text-align: center; border-bottom: 2px solid black;"><a href="First_select.html">Misc</a></li>
<li style="text-align: center; border-bottom: 2px solid black;"><a href="Second_select.html">Misc</a></li>
<li style="text-align: center; border-bottom: 2px solid black;"><a href="Third_select.html">Misc</a></li>
<li style="text-align: center; border-bottom: 2px solid black;"><a href="Fourth_select.html">Misc</a></li>
<li style="text-align: center; border-bottom: 2px solid black;"><a href="Fith_select.html">Misc</a></li>
<li style="text-align: center; border-bottom: 2px solid black;"><a href="Sixth_select.html">Misc</a></li>
<li style="text-align: center; border-bottom: 2px solid black;"><a href="Seventh_select.html">Misc</a></li>
<li style="text-align: center; border-bottom: 2px solid black;"><a href="Eighth_select.html">Misc</a></li>
<li style="text-align: center; border-bottom: 2px solid black;"><a href="Nith_select.html">Misc</a></li>
<li style="text-align: center; border-bottom: 2px solid black;"><a href="Tenth_select.html">Misc</a></li>
<li style="text-align: center; border-bottom: 2px solid black;"><a href="Elventh_select.html">Misc</a></li>
<li style="text-align: center; border-bottom: 2px solid black;"><a href="Twelth_select.html">Misc</a></li>
<li style="text-align: center; border-bottom: 2px solid black;"><a href="Thirteenth_select.html">Misc</a></li>
</ul>
</nav>

<div style="margin-left:242px;padding:1px 16px;height:1000px;">
  <article>    
Lorem ipsum dolor sit amet consectetur adipisicing elit. Enim sint vel impedit minima sapiente, tempore ut minus obcaecati mollitia modi quod perferendis. Perspiciatis maxime natus amet accusantium sunt labore praesentium.
</article>

</body>
</html>

and here it is with the div:

<!DOCTYPE html>
<html lang="en">



<style>
.Currsel{
    text-align: center;
    font-size: 22px;
    color: #f0f0f0;
    font-family: 'Lucida Sans', 'Lucida Sans Regular', 'Lucida Grande', 'Lucida Sans Unicode', Geneva, Verdana, sans-serif;
    background-color: #313031;
    border: 1px solid #555555;
    height: 125px;
    width: 260px;
    margin: -8px;
}
.navbar ul{
  list-style-type: none;
  margin: -8px;
  padding: 0;
  width: 260px;
  height: 100%;
  position:fixed;
  background-color: #313031;
  text-align: center;
  border: 1px solid #555555;
  overflow: auto;
 
}
.navbar a {
  display: block;
  color: white;
  padding: 8px 16px;
  font-size: 20px;
  text-decoration: none;
}
.navbar a:hover {
background-color: #545254;
color: white;
}


</style>
</head>


<body>
    <div class="Currsel">
        <p>Currently Selected:</p>
        <p style="color: #67a92b; text-decoration: underline;">Second_select</p>


    </div>
    <nav class="navbar">
        <ul>
            <li style="text-align: center; border-bottom: 2px solid black; border-top: 2px solid black;background-color: #545254;"><a href="index.html">home</a></li>
            <li style="text-align: center; border-bottom: 2px solid black;"><a href="First_select.html">Misc</a></li>
            <li style="text-align: center; border-bottom: 2px solid black;"><a href="Second_select.html">Misc</a></li>
            <li style="text-align: center; border-bottom: 2px solid black;"><a href="Third_select.html">Misc</a></li>
            <li style="text-align: center; border-bottom: 2px solid black;"><a href="Fourth_select.html">Misc</a></li>
            <li style="text-align: center; border-bottom: 2px solid black;"><a href="Fith_select.html">Misc</a></li>
            <li style="text-align: center; border-bottom: 2px solid black;"><a href="Sixth_select.html">Misc</a></li>
            <li style="text-align: center; border-bottom: 2px solid black;"><a href="Seventh_select.html">Misc</a></li>
            <li style="text-align: center; border-bottom: 2px solid black;"><a href="Eighth_select.html">Misc</a></li>
            <li style="text-align: center; border-bottom: 2px solid black;"><a href="Nith_select.html">Misc</a></li>
            <li style="text-align: center; border-bottom: 2px solid black;"><a href="Tenth_select.html">Misc</a></li>
            <li style="text-align: center; border-bottom: 2px solid black;"><a href="Elventh_select.html">Misc</a></li>
            <li style="text-align: center; border-bottom: 2px solid black;"><a href="Twelth_select.html">Misc</a></li>
            <li style="text-align: center; border-bottom: 2px solid black;"><a href="Thirteenth_select.html">Misc</a></li>
        </ul>
    </nav>


<div style="margin-left:242px;padding:1px 16px;height:1000px;">
  <article>    
Lorem ipsum dolor sit amet consectetur adipisicing elit. Enim sint vel impedit minima sapiente, tempore ut minus obcaecati mollitia modi quod perferendis. Perspiciatis maxime natus amet accusantium sunt labore praesentium.
</article>


</body>
</html><!DOCTYPE html>
<html lang="en">



<style>
.Currsel{
    text-align: center;
    font-size: 22px;
    color: #f0f0f0;
    font-family: 'Lucida Sans', 'Lucida Sans Regular', 'Lucida Grande', 'Lucida Sans Unicode', Geneva, Verdana, sans-serif;
    background-color: #313031;
    border: 1px solid #555555;
    height: 125px;
    width: 260px;
    margin: -8px;
}
.navbar ul{
  list-style-type: none;
  margin: -8px;
  padding: 0;
  width: 260px;
  height: 100%;
  position:fixed;
  background-color: #313031;
  text-align: center;
  border: 1px solid #555555;
  overflow: auto;
 
}
.navbar a {
  display: block;
  color: white;
  padding: 8px 16px;
  font-size: 20px;
  text-decoration: none;
}
.navbar a:hover {
background-color: #545254;
color: white;
}


</style>
</head>


<body>
    <div class="Currsel">
        <p>Currently Selected:</p>
        <p style="color: #67a92b; text-decoration: underline;">Second_select</p>


    </div>
    <nav class="navbar">
        <ul>
            <li style="text-align: center; border-bottom: 2px solid black; border-top: 2px solid black;background-color: #545254;"><a href="index.html">home</a></li>
            <li style="text-align: center; border-bottom: 2px solid black;"><a href="First_select.html">Misc</a></li>
            <li style="text-align: center; border-bottom: 2px solid black;"><a href="Second_select.html">Misc</a></li>
            <li style="text-align: center; border-bottom: 2px solid black;"><a href="Third_select.html">Misc</a></li>
            <li style="text-align: center; border-bottom: 2px solid black;"><a href="Fourth_select.html">Misc</a></li>
            <li style="text-align: center; border-bottom: 2px solid black;"><a href="Fith_select.html">Misc</a></li>
            <li style="text-align: center; border-bottom: 2px solid black;"><a href="Sixth_select.html">Misc</a></li>
            <li style="text-align: center; border-bottom: 2px solid black;"><a href="Seventh_select.html">Misc</a></li>
            <li style="text-align: center; border-bottom: 2px solid black;"><a href="Eighth_select.html">Misc</a></li>
            <li style="text-align: center; border-bottom: 2px solid black;"><a href="Nith_select.html">Misc</a></li>
            <li style="text-align: center; border-bottom: 2px solid black;"><a href="Tenth_select.html">Misc</a></li>
            <li style="text-align: center; border-bottom: 2px solid black;"><a href="Elventh_select.html">Misc</a></li>
            <li style="text-align: center; border-bottom: 2px solid black;"><a href="Twelth_select.html">Misc</a></li>
            <li style="text-align: center; border-bottom: 2px solid black;"><a href="Thirteenth_select.html">Misc</a></li>
        </ul>
    </nav>


<div style="margin-left:242px;padding:1px 16px;height:1000px;">
  <article>    
Lorem ipsum dolor sit amet consectetur adipisicing elit. Enim sint vel impedit minima sapiente, tempore ut minus obcaecati mollitia modi quod perferendis. Perspiciatis maxime natus amet accusantium sunt labore praesentium.
</article>


</body>
</html>

I decided I was going to learn html and css like 3 days ago, so if my code is shit feel free to pick it apart.

edit: I messed up at using reddit and the first code isn't in a code block. It's in the comments though.


r/css • • 5d ago

AI Assisted First npm package ever: scrollbars that don't shift your layout. Would love some feedback

1 Upvotes

Hey folks,

You know when a scrollbar pops in and everything jumps a few pixels to the left? That annoyed me enough that I made a little library for it.

One line at the root of your app, that's it:

```tsx

<MrScroll />

```

No reserved gutter, still the native scrollbar. It just finds a spot for the scrollbar so your content stays put.

- Try it: https://justicehwan.github.io/plz-mr-scroll/

- GitHub: https://github.com/justicehwan/plz-mr-scroll

It's my first library ever, so I honestly have no idea what I got wrong. If you have a minute, please take a look and tell me what's broken or dumb 🥲

P.S. I'm Korean and English isn't my first language, so sorry if anything here reads a bit off.

Thanks!


r/css • • 6d ago

Question can yall rate my page styling

0 Upvotes

click here

you may also rank the whole page if ya want!!11!1!1!

okthxbye


r/css • • 7d ago

Question Gradient text with solid color outline?

3 Upvotes

I'm trying to make gradient text that has an outline, and it's driving me mad. Nothing I find online works. Is there any way to do this?

Just to be clear, i want the text to have a gradient but the outline to be a solid color.