r/css

▲ 4 r/css

Image linked from CSS ?

Why do some people have images in their website linked to from their CSS, rather than just referencing the image once in their HTML?

reddit.com
u/Chris-2018 — 10 hours ago
▲ 1 r/css

Cool trick to makes a text "glow" in CSS

This is a cool trick that uses text-shadow to make text glow like a light:

color: #00ffc0;

text-shadow: 0 0 1px #00ffc0,0 0 11px #00ffc0;

the trick is to give several text-shadow being more and more blurred and with a more and more transparent color.

Hope it can help some ! :)

reddit.com
u/ArchivesUnexplained — 12 hours ago
▲ 0 r/css

Help! My div doesn't flow to the end of the page

I have the categories with white-space: no wrap but the div they're in doesn't go to the end of the page.

The categories are inside the darker red rectangle. But while the text goes to the end of the page, the color block doesn't.

This happens when I have a smaller viewport and scroll to the right.

I would really appreciate the help!

I want the light red banner to stay in place even while scrolling to the right, that is the title "Mixed Media Magazine" to stay centered even as the viewport changes or the user scrolls to the right.

And for the dark red banner to reach the end of the page, while the text "moves" - new text as you scroll.

Repository: https://github.com/Margarida21s/M3.git

u/Maggie21S — 1 day ago
▲ 11 r/css

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)

reddit.com
u/Blozz12 — 1 day ago
▲ 16 r/css

I want to do Web Design as a career, what to learn?

Hi Reddit,

I'm a 15 year old going into the 11th grade and I want to make Web Design (or something of that nature) my career. I've been learning it off and on since I was 14. I'd describe myself as a beginner. I can make simple static websites. I don't know grid or flexbox yet (I know, that's kind of bad).

Because I want a job that would require me to use HTML, CSS, and Javascript, I know I will need skill. I want to progress into a beginner into a pro. I'm also going to take a computer class that will go over HTML, CSS, and Javascript, but I don't know if it will go in depth.

I'm going to study lots over the summer in hopes of becoming an intermediate. I'm wondering what I need to learn to be employable, but also what the fundamentals are, so I can master them.

Thanks so much

reddit.com
u/Obvious-Check-7638 — 2 days ago
▲ 0 r/css

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?

reddit.com
u/Mental-Ad100 — 2 days ago
▲ 3 r/css

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.

reddit.com
u/envisualist — 1 day ago
▲ 14 r/css+1 crossposts

I built HTML/CSS, CSS, Bootstrap to Tailwind converters

Hey everyone,

I made a few simple tools that help convert existing code to Tailwind. They're support preview, fullscreen, really complex sources. Also they have responsive support, so you can shrink your side window and use them in parallel. They're completely free, enjoy!

HTML/CSS to Tailwind:
https://tailfind.org/html-css-to-tailwind

CSS to Tailwind:
https://tailfind.org/css-to-tailwind

Bootstrap to Tailwind:
https://tailfind.org/bootstrap-to-tailwind

Now I want to add output configuration, like apply prefixes, units (px/rem), etc..

Would love to hear your feedback or suggestions for improvement.

u/akopian25 — 1 day ago
▲ 5 r/css+1 crossposts

I built a Chrome extension to preview multiple devices at once

Hey everyone,

While working on one of my projects, I kept running into the same issue again and again: checking responsiveness across multiple devices was taking way too much time.

I would make a small UI change, it would look fine on desktop, but then something would break on mobile. Then I’d fix mobile, and tablet would look off. It became a loop of resizing the browser, switching device modes, and testing one screen size at a time.

I tried looking for tools that could make this easier, but most of them either showed only one device at a time or didn’t really fit how I wanted to review the UI.

So I built Multi Device Viewer, a Chrome extension that lets you preview multiple devices side by side in one view.

It helps with:

  • Viewing multiple devices at once
  • Testing mobile, tablet, desktop, and custom screen sizes
  • Catching responsive layout issues faster
  • Reviewing UI changes without constantly resizing or switching tabs

Would love to hear your feedback if you try it.https://chromewebstore.google.com/detail/multi-device-viewer/jfcnekmenjickfihkniaoaklehjmdhdb?authuser=0&hl=en-GB

https://preview.redd.it/wr2nofgtjw1h1.png?width=2048&format=png&auto=webp&s=135ccfc9bd207e34ae53a338180499b6c402c79f

reddit.com
▲ 2 r/css

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

u/deppresedgamerkai — 2 days ago
▲ 7 r/css

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.

u/SalahAlmahrooq — 2 days ago
▲ 0 r/css

Modern Gradient Text Animation Using HTML CSS

🚀 Learn how to create a Modern Gradient Text Animation using HTML & CSS with futuristic neon glow effects, animated gradients, glassmorphism UI, and smooth pulse animations. Perfect for modern websites & frontend practice projects.

✨ Features:
• Animated Gradient Text
• Neon Glow Typography
• Glassmorphism Design
• Responsive UI
• CSS Keyframe Animations
• Modern Landing Page Effects

🎥 Full Tutorial: https://www.youtube.com/shorts/7NMDoV-FLfA

#CSS #WebDesign #Frontend #CSSAnimation #GradientText #UIDesign #WebDevelopment #NeonUI #Programming #Coding #HTMLCSS #Shorts

#HTML

u/BlackberryAlert8601 — 2 days ago
▲ 0 r/css

The easiest way to vertically center a div

If you're centering content inside a container, Flexbox is usually the simplest solution.

.container {
  display: flex;
  align-items: center;
  justify-content: center;
  height: 100vh;
}

Why it works -

  • align-items: center → vertical alignment
  • justify-content: center → horizontal alignment
  • height: 100vh → full viewport height
reddit.com
u/riti_rathod — 3 days ago
▲ 15 r/css

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?

reddit.com
u/Nonilol — 3 days ago
▲ 1 r/css+1 crossposts

I built Twift: A free Chrome Extension that scans any site and generates a Tailwind v4 @theme block instantly

Hi All, recently I just launched a Google Chrome extension that could help developers who are struggling to migrate or extract brand styles from existing sites.

With the launch of Tailwind CSS v4 and its new CSS-variable-first configuration, I found myself spending too much time in the DevTools "Inspect" element trying to dig out variables, color palettes, and spacing scales just to build a new v4 configuration.

So I built Twift to automate that entire workflow.

https://chromewebstore.google.com/detail/twift/nnejighghchkkhogfpelddhmiiklmnbp

u/WhileOdd9582 — 3 days ago
▲ 3 r/css

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?

reddit.com
u/Ken_Ben_ — 3 days ago
▲ 4 r/css+1 crossposts

Do you prefer XPath, CSS selectors, or something else?

I’ve been seeing people argue XPath vs CSS selectors like it’s some huge loyalty thing, so I’m curious how people here actually use them once a scraper gets past the quick test stage.

I used to default to CSS selectors because they felt easier to read while I was building. They still feel cleaner to me when the page has decent class names or a simple structure. The problem is that a lot of sites do not make it that easy. Sometimes the useful data is sitting near a label, inside a weird table, or buried in markup that clearly wasn’t written with scraping in mind.

That’s where XPath started making more sense to me. Not as my default for everything, but as the thing I reach for when CSS starts feeling like I’m forcing it. At this point I don’t really care which one is supposed to be better. I care about what I can come back to later without hating myself when the site changes.

reddit.com
u/BlueLagoon226 — 3 days ago
▲ 4 r/css

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?

reddit.com
u/mr_cody_b — 4 days ago
▲ 5 r/css+2 crossposts

Bootstrap 5 theming: CSS overriding or modular replacement?

There are two possible paths when generating themes for Bootstrap 5, and I’d like to hear the community’s take on their pros and cons.

On one side there’s bootstrap-dynamic-themes, a theme editor whose current approach is simple: leave the original Bootstrap CSS untouched and produce an extra stylesheet that overrides variables and component rules wherever a visual change is needed.

This comes with several benefits:

  • Adoption is immediate, since the project still consumes unmodified Bootstrap.
  • The core of Bootstrap stays intact, which brings peace of mind.
  • Anyone already used to overriding Bootstrap can understand the mechanism quickly.
  • The theme can be added or removed without affecting the base CSS.

The main downside shows up as the theme grows: the override CSS starts duplicating more and more Bootstrap logic. The end result is the original Bootstrap CSS plus an increasingly heavy extra layer.

The other path comes from BootstrapDyn.

The philosophy here is different. Instead of treating Bootstrap as a fixed block that needs patching, BootstrapDyn breaks down Bootstrap 5.3’s compiled CSS and reorganises it into independent modules governed by CSS custom properties.

The process outputs several files:

  • bootstrap-dyn.css: the component layer that stays compatible with Bootstrap
  • default-color.css
  • default-typography.css
  • default-spacing.css
  • default-borders.css
  • default-shadows.css
  • other theme modules
  • an optional contrast-dyn.css module meant for automatic contrast adjustments

The crucial point is that, using the default modules, the visual output should be identical to original Bootstrap. The starting point doesn’t change; what changes is where the design values live.

So instead of building a theme by stacking overrides on top of Bootstrap, the proposal is to swap modules:

<link rel="stylesheet" href="theme/my-color.css">
<link rel="stylesheet" href="theme/my-typography.css">
<link rel="stylesheet" href="theme/my-spacing.css">
<link rel="stylesheet" href="dist/bootstrap-dyn.css">

Theme files don’t add rules on top; they directly replace the default modules.

This replacement model brings its own set of trade-offs:

  • It tends to produce lighter themes with less redundancy.
  • It avoids repeating large chunks of Bootstrap component CSS.
  • The separation by concern (colours, typography, spacing) becomes explicit.
  • But it requires trusting the generated bootstrap-dyn.css layer.
  • It changes the way CSS is distributed, which may be a higher barrier to entry than a simple override stylesheet.
  • It demands thorough visual validation to guarantee that, with the default modules, everything renders exactly like Bootstrap.

The goal is to make BootstrapDyn the foundation for future versions of bootstrap-dynamic-themes. That way, the editor could export modular, more compact themes without the bloat of the current duplication.

In a nutshell:

  • Current approach: original Bootstrap CSS + generated override CSS.
  • Proposed approach: Bootstrap-compatible component CSS + replaceable theme modules.

This promises themes that are easier to read, bundle, and serve. But it’s not taken for granted that this is the better option in every scenario.

Visual parity and edge cases across Bootstrap components are still being validated, though the direction feels cleaner than the override-heavy model.

The open question is which strategy makes more sense in the long run:

  1. Keep the original Bootstrap CSS and generate an override layer.
  2. Transform Bootstrap into a modular CSS-variable distribution (compatible with Bootstrap) and allow theme module replacement.

I’d be interested in hearing from anyone who has worked with Bootstrap theming, design token systems, CSS-variable-based frameworks, or maintaining design systems at scale.

In a real project, which route would you choose and why?

Is the simplicity and safety of the override approach worth the CSS duplication?

Or is the modular replacement scheme a stronger foundation if visual parity can be reliably maintained?

For context, this is the current editor built with the override strategy:

Bootstrap Dynamic Themes editor

u/Money_Big_7666 — 4 days ago