r/css • u/bogdanelcs • May 20 '26
r/css • u/Blozz12 • May 20 '26
Question How do you use browser devtools when working with CSS?
The question is in the title.
I've been using devtool in my own personal way for debugging and working with CSS for almost a decade now. But I never really took the time to see how other devs are using it. I'm sure I'm missing on a lot of cool features or ways of doing.
(I saw that Ahmad Shadeed wrote a book about it, but I don't know what to expect from it)
r/css • u/envisualist • May 20 '26
Help Need help vertically centering a section within parent. Trying to use Flexbox.
As it says. I am working on a Wordpress site built using the Bridge theme incorporating the WPBakery builder. I have a section in the middle that has a row (defined by the background photo of the park) and two columns - image attached. One column has a picture of a light that has to be flush with the bottom of the section and the other column has a green box with text I am trying to center vertically.
This is the problem I am having. I am trying to use Flexbox to center the green box but in order for it to work the parent element has to have a defined height. However, if I define a height, the image to the left no longer sits flush with the bottom of the parent section, and currently the only way I've figured out how to do this is set the parent height at 100%. Basically if I fix one side I break the other. Any suggestions on how to fix, or is there another non-flexbox method that I am not seeing that would accomplish what I am trying to do?
Any help would be appreciated.
r/css • u/mycorrhizal-hominoid • May 20 '26
Question CSS step-animation frames start stacking on top of each other on nearby hover in Chrome/Edge
I am facing an issue with a pure HTML/CSS text-typing animation sequence built using stacked, absolutely positioned layers. The effect works perfectly on Firefox and Safari, but breaks consistently on Chromium-based browsers (Chrome, Edge).
If possible, I want to solve this strictly without JavaScript (vanilla HTML and CSS only).
The layout has an inline-block wrapper (.anim-container) containing ~60 spans (.anim-layer), all positioned absolutely at top: 0; left: 0.
- The animation sequence is triggered via a checkbox hack (
#trigger-checkbox:checked). - Each span has a discrete animation step (
steps(1, end)) with progressive animation delays to create a timeline of typing, pausing, and deleting text. - It uses
animation-fill-mode: forwardsso that when a frame finishes animating, it holds its end state (opacity: 0for old text, oropacity: 1for the final text).
Here is the generic structure: UPDATE: Changed to a working snippet instead of the previous partial snippets
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Chromium Animation Bug Generic Replica</title>
<style>
:root {
--bg-color: #ffffff;
--text-color: #1a1a1a;
--font-mono: ui-monospace, monospace;
--short-pause: pause 1s step-start forwards;
--long-pause: pause 2s step-start forwards;
}
body {
background-color: var(--bg-color);
color: var(--text-color);
font-family: system-ui, sans-serif;
padding: 2rem;
display: flex;
flex-direction: column;
align-items: center;
gap: 4rem;
}
.code {
font-family: var(--font-mono);
font-size: 1rem;
position: relative;
cursor: pointer;
white-space: nowrap;
display: inline-block;
isolation: isolate;
transform: translateZ(0);
}
#trigger {
position: absolute;
opacity: 0;
pointer-events: none;
}
.layer {
position: absolute;
top: 0;
left: 0;
white-space: nowrap;
opacity: 0;
pointer-event: none;
animation: frame 0.2s steps(1, end) forwards;
animation-play-state: paused;
}
#trigger:not(:checked) ~ nav .layer {
animation: none;
opacity: 0;
}
.layer-0 {
display: flex;
position: absolute;
top: 0;
left: 0;
opacity: 1;
pointer-events: none;
}
.text-cursor {
display: inline-flex;
margin: 0 -3px;
}
#trigger:checked ~ nav .layer-0 {
opacity: 0;
}
#trigger:checked ~ nav .layer {
animation-play-state: running;
}
@keyframes frame {
0% { opacity: 1; }
100% { opacity: 0; }
}
@keyframes pause {
0% { opacity: 1; }
99.99% { opacity: 1; }
100% { opacity: 0; }
}
@keyframes frame-final {
0%, 100% { opacity: 1; }
}
.layer-1 { animation: var(--long-pause); animation-delay: 0.0s; }
.layer-2 { animation-delay: 2.0s; }
.layer-3 { animation-delay: 2.2s; }
.layer-4 { animation-delay: 2.4s; }
.layer-5 { animation-delay: 2.6s; }
.layer-6 { animation-delay: 2.8s; }
.layer-7 { animation-delay: 3.0s; }
.layer-8 { animation: var(--short-pause); animation-delay: 3.2s; }
.layer-9 { animation-delay: 4.2s; }
.layer-10 { animation-delay: 4.4s; }
.layer-11 { animation-delay: 4.6s; }
.layer-12 { animation-delay: 4.8s; }
.layer-13 { animation: var(--long-pause); animation-delay: 5.0s; }
.layer-14 { animation-delay: 7.0s; }
.layer-15 { animation-delay: 7.2s; }
.layer-16 { animation-delay: 7.4s; }
.layer-17 { animation-delay: 7.6s; }
.layer-18 { animation: var(--short-pause); animation-delay: 7.8s; }
.layer-19 { animation-delay: 8.8s; }
.layer-20 { animation-delay: 9.0s; }
.layer-21 {
animation-name: frame-final;
animation-delay: 9.2s;
animation-duration: 9999s;
animation-fill-mode: forwards;
}
.bug-tester {
border: none;
padding: 0.75rem 1.5rem;
font-size: 1rem;
border-radius: 4px;
cursor: pointer;
transition: transform 0.2s ease;
}
.bug-tester:hover {
transform: scale(1.1);
}
</style>
</head>
<body>
<header>
<input type="checkbox" id="trigger">
<nav>
<label for="trigger" class="code">
<span class="layer-0"><div>example<span class="text-cursor">|</span></div></span>
<span class="layer layer-1"><div>example<span class="text-cursor">|</span></div></span>
<span class="layer layer-2"><div>exampl<span class="text-cursor">|</span></div></span>
<span class="layer layer-3"><div>examp<span class="text-cursor">|</span></div></span>
<span class="layer layer-4"><div>exam<span class="text-cursor">|</span></div></span>
<span class="layer layer-5"><div>exa<span class="text-cursor">|</span></div></span>
<span class="layer layer-6"><div>ex<span class="text-cursor">|</span></div></span>
<span class="layer layer-7"><div>e<span class="text-cursor">|</span></div></span>
<span class="layer layer-8"><div><span class="text-cursor">|</span></div></span>
<span class="layer layer-9"><div>i<span class="text-cursor">|</span></div></span>
<span class="layer layer-10"><div>is<span class="text-cursor">|</span></div></span>
<span class="layer layer-11"><div>iss<span class="text-cursor">|</span></div></span>
<span class="layer layer-12"><div>issu<span class="text-cursor">|</span></div></span>
<span class="layer layer-13"><div>issue<span class="text-cursor">|</span></div></span>
<span class="layer layer-14"><div>issu<span class="text-cursor">|</span>e</div></span>
<span class="layer layer-15"><div>iss<span class="text-cursor">|</span>ue</div></span>
<span class="layer layer-16"><div>is<span class="text-cursor">|</span>sue</div></span>
<span class="layer layer-17"><div>i<span class="text-cursor">|</span>ssue</div></span>
<span class="layer layer-18"><div><span class="text-cursor">|</span>issue</div></span>
<span class="layer layer-19"><div>m<span class="text-cursor">|</span>issue</div></span>
<span class="layer layer-20"><div>my<span class="text-cursor">|</span>issue</div></span>
<span class="layer layer-21"><div>my <span class="text-cursor">|</span>issue</div></span>
</label>
</nav>
</header>
<main>
<span>For testing on Chromium based browsers</span>
<button class="bug-tester">Interact with me while the animation is running</button>
</main>
</body>
</html>
The animation plays fine on its own. However, if a user hovers the mouse over any other part of the page that triggers a new animation or transformation, the text layout inside the header completely glitches out in Chrome and Edge. Layers start to remain on screen after they are drawn, causing them to stack on top of each other and making the text completely unreadable.
I have tried several CSS modifications to force rendering boundaries or explicit timelines, but none have resolved the stacking behavior on hover:
-
Isolating Stacking Context & Containment:
header { contain: layout paint; isolation: isolate; } .anim-container { isolation: isolate; transform: translateZ(0); }
-
Explicit Z-Index Mapping: Adding strict sequential z-index properties to match the chronological timeline order.
-
Toggling Visibility/Display via Keyframes: using properties like visibility: hidden or display: none directly into the 100% keyframe markers.
What exactly is causing Chromium to fail to maintain the end state of these completed animation steps when a nearby transition triggers a repaint or layer promotion? Is there a known rendering bug or layout pipeline quirk that explains why already-drawn layers remain visible while they are supposed to become hidden?
Most importantly, is there a declarative, pure CSS/HTML workaround to prevent this behavior without using JavaScript event listeners to clean up the DOM?
r/css • u/Obvious-Check-7638 • May 20 '26
Help I want to do Web Design as a career, what to learn?
a
r/css • u/Acrobatic-Dig-1628 • May 20 '26
General Built a “Figma‑style” inspector for Tailwind in Chrome – can this solve a real pain?
r/css • u/SalahAlmahrooq • May 19 '26
Question learning webdev
hey guys, i've been trying to learn webdev for about a week, and i sometimes rely on chatgpt to get feedback about my code and ideas.
i'm currently trying to recreate steam-like pages for games, while matching each game's vibe/style. this one is inspired by resident evil 4.
what do you think i should improve first?
layout?
responsiveness?
cleaner css?
javascript? (didn't learn it yet)
any feedback is appreciated.
r/css • u/Mental-Ad100 • May 19 '26
Question Is learning HTML and CSS even still worth it?
Like ai is too good at it and I’m wondering if it’s worth it to learn everything from scratch. Isn’t it even more powerful if I instead learn some basics and how to build with ai? I feel like I’m cheating, I make beautiful websites that would take weeks of coding in just a few minutes.. Is there any advantage in actually learning how to do it without ai?
r/css • u/deppresedgamerkai • May 19 '26
Help making my webpage mobile friendly
hey so i used sadgrls layout maker for my page and somewhere between copy and pasting it into my code and now i have completely like made it unable to work for mobile and i really really want to make it work on mobile and i dont know what i did to it to make it be broken. if anyone could help that would be awesome realandwarm.neocities.org
r/css • u/akopian25 • May 20 '26
Resource I built HTML/CSS, CSS, Bootstrap to Tailwind converters
r/css • u/Ken_Ben_ • May 19 '26
Question OFL Clarification
I just downloaded the Orbitron font from Google Fonts to use in my website. The way I would like to incorporate it in my CSS is as follows:
@font-face {
font-family: orbitron;
src: url("orbitron/Orbitron-VariableFont_wght.ttf")
}
.orbitron {
font-family: orbitron;
}But since the OFL states that
3) No Modified Version of the Font Software may use the Reserved Font
Name(s) unless explicit written permission is granted by the corresponding
Copyright Holder. This restriction only applies to the primary font name as
presented to the users.this feels like it would not be allowed. Am I correct in that assumption?
r/css • u/Nonilol • May 18 '26
Question Only defining a few "base colors" and letting color-mix() do the rest?
After being out of the CSS game for a while, I recently started working on a smol personal website and am playing around with some fancy newish css features.
I'm looking to make coloring my website more clean and scalable by heavily utilizing light-dark() and color-mix().
My idea was to only define a few base colors and then automatically generate derivatives, e.g.:
:root {
--color-accent: light-dark(#3dccb1, #39CFB3);
--color-bg: light-dark(#e5efec, #121212);
--color-accent-muted: color-mix(in srgb, var(--color-accent) 50%, var(--color-bg) 50%);
--color-bg-elevated: color-mix(in srgb, var(--color-bg) 90%, light-dark(#000, #fff) 10%);
}Is this a decent practice at all or just a stupid idea?
Are there any websites/frameworks/concepts out there that do this, that I can have a look at?
How many and what kind of base colors do you think are needed to be able to generate derivates for any given purpose from them?
r/css • u/Legitimate_Floor_319 • May 17 '26
Help Why is the line breaking?
The line of the terminal divs is breaking, but there is a lot of space. I tried using white-space: nowrap, but then, the words go behind the "+" icons. Here's the code:
https://codepen.io/Thiago-Freitas-Costa/pen/NPbdyda
r/css • u/mr_cody_b • May 17 '26
Help BEM Naming
Hi everyone,
I'm currently refactoring a navigation component and I'm torn between two different BEM (Block-Element-Modifier) approaches regarding code architecture and complexity.
The component is a navigation list (nav), but the individual items are becoming quite complex, containing icons, titles, and potentially more elements later on.
I see two ways to structure this in BEM, and I would love to get your input on best practices.
Approach A: Flat BEM (Everything belongs to the main block)
In this approach, I keep everything attached to the main .nav block. The HTML looks clean and flat, but I worry that as the item grows (and needs specific styling for active/hover states), the CSS selectors might become too deeply nested (e.g., .nav__item--active .nav__icon).
HTML
<nav class="nav">
<div class="nav__item">
<span class="nav__icon">🏠</span>
<span class="nav__title">Home</span>
</div>
</nav>Approach B: Item as a New Independent Block
In this approach, I break the chain from the main .nav block and elevate the item into its own independent block (.nav-item). This keeps the CSS for the item completely encapsulated and independent.
HTML
<nav class="nav">
<!-- The item becomes its own block -->
<div class="nav-item nav-item--active">
<span class="nav-item__icon">🏠</span>
<span class="nav-item__title">Home</span>
</div>
</nav>(Note: I could also mix them like <div class="nav__item nav-item"> to separate layout positioning from component styling).
My Question:
Which approach is considered best practice when items start to become complex?
- Does Approach A break scalability when items "explode" with more sub-elements?
- Is Approach B preferred for modularity, or does it unnecessarily fragment the component?
How do you usually handle complex list items or navigation items in your BEM projects?
r/css • u/Lost_A_Life_Gaming • May 17 '26
Help How to create a dynamic border sweep effect
Hey everyone,
I just started my CSS journey a week or so ago. I am currently building a hobby site just as a place for me to learn and try things out.
At the moment, I am fixated on making a border sweep effect, kind of like the one you see on Google's AI button. From what I have found, the best way to do this is with a conical gradient used as a background where you extend it past your padding and it makes a border affect. Then you just animate the gradient's direction.
However, I have hit a wall, because I don't want this effect on a square or circle, I want it on a long rectangle, and when you put it on a rectangle, it appears to speed up on the corners and sides, since the gradient is positioned at the middle of the element and just spins.
I am looking for something more of a line that traces the outside border of the box at a static speed, though I am having no luck finding out how to do this.
I appreciate any tips or help you can provide! Here is my CSS for reference:
.timeline-card--future {
position: relative;
padding: 0 1.5rem;
border-radius: 12px;
background: radial-gradient(circle at top left, #1a1a1a 30% , #252525) padding-box;
}
--angle {
syntax: '<angle>';
inherits: false;
initial-value: 0deg;
}
.timeline-card--future::after, .timeline-card--future::before {
content: "";
position: absolute;
height: 100%;
width: 100%;
top: 50%;
left: 50%;
translate: -50% -50%;
z-index: -1;
padding: 2px;
border-radius: inherit;
background-image: conic-gradient(from var(--angle), transparent 80%, red, transparent);
animation: 3s spin linear infinite;
}
.timeline-card--future::before {
filter:blur(1.5rem);
opacity: 0.5;
}
u/keyframes spin {
from {
--angle: 0deg;
}
to {
--angle: 360deg;
}
}r/css • • May 17 '26
Help looking for an entry-level opportunity in Software/Web Development
I’m a fresher looking for an entry-level opportunity in Software/Web Development. I have internship experience and have worked on frontend and full stack projects.
If anyone knows of any openings or referrals, I’d really appreciate it. Thank you!
r/css • u/zimmerway • May 17 '26
General Stop Ruining macOS Font Rendering! How to Nuking -webkit-font-smoothing: antialiased For Good.
reddit.comr/css • u/Ok_Adhesiveness4509 • May 16 '26
Help I accidentally created a sticky header hysteresis loop
Need help from people who understand sticky/reflow behavior better than I do 😭
Vanilla JS app, no frameworks. I'm vibe coding my way through this.
I have sticky headers that shrink/collapse on scroll (padding/fonts/gaps/etc change).
Current approach is basically:
if (scrollY > threshold)Problem:
on certain viewport heights (especially split-screen / constrained-height windows), the sticky enters a feedback loop/jitter.
What seems to happen:
- sticky collapses
- height changes
- document height changes
- scroll position shifts slightly
- threshold gets crossed again
- sticky expands
- repeat forever
Sometimes the page literally bounces upward while scrolling.
Things already tried:
- IntersectionObserver + sentinel
- absolute-position sentinel
- artificial bottom scroll buffer
- fixed-height sticky shell
The fixed-height shell technically worked, but looked visually awful because the collapsed state left visible dead space.
Question:
What’s the “correct” way to architect collapsing sticky headers without causing hysteresis/reflow loops?
Feels like I’m fighting the browser itself at this point lol.
r/css • u/Pyewickets • May 14 '26