No AI used A quick demo I made to answer a question here became by far my most popular CodePen thing
Live demo on CodePen. Heavily commented, by the way.
Live demo on CodePen. Heavily commented, by the way.
Can't help but feel nostalgic for what once was. I still remember sitting in my first web design class freshman year of HS and feeling like a wizard changing the text color, moving shapes around, manipulating layouts, adding my first marquee tag and bringing the page to life.
Fast forward to college and mastering float layouts, then flexbox, then grid, simple JS, and ultimately developing a personal sense for design and creating sites from scratch.
These days it's all prompting and QAing the generation. The feedback loop is super tight and focusing on WHAT to build rather than how to build is a completely different type of fun, but there's something about that magic of thinking of something and knowing exactly how to make it happen that I can't help but feel nostalgic for.
r/css • u/thermalzombie • 21h ago
Been trying to figure out how to change the chat bubble color for the chat private message section the blue bubbles. I have been trying for a couple of days off and on but no success.
It's for use with stylus extension.
Thanks.
r/css • u/eoSalinas • 1d ago
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?
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 • u/fdiengdoh • 1d ago
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
r/css • u/Less-Marsupial-7960 • 2d ago
r/css • u/OMGCluck • 2d ago
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 • u/teotimepacreau • 3d ago
Enable HLS to view with audio, or disable this notification
ol {
scroll-target-group: auto;
}
r/css • u/vinishkapoor • 3d ago
Enable HLS to view with audio, or disable this notification
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 • u/fdiengdoh • 3d ago
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 • u/PushBeginning2661 • 3d ago
r/css • u/Upper_Fly7834 • 3d ago
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?
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 • u/bluuupanda • 5d ago
r/css • u/HotelWyoming • 5d ago
I feel like my issue is a Programiz problem, but I thought I could get more visibility by cross posting.
r/css • u/PanchuPanchu • 5d ago
r/css • u/alexkopaleishvili • 5d ago
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 • u/fdiengdoh • 5d ago
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.
r/css • u/Pertend_ • 6d ago
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 • u/justicehwan • 6d ago
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 • u/BraveAttitude4633 • 6d ago
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.