Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. Other Discussions
  3. Site Bugs / Suggestions
  4. Please, don't use CSS !important on background or text

Please, don't use CSS !important on background or text

Scheduled Pinned Locked Moved Site Bugs / Suggestions
htmlcssvisual-studiocomdocker
2 Posts 2 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • M Offline
    M Offline
    Member_14801643
    wrote on last edited by
    #1

    I like using custom CSS stylesheets (via Stylus Add-on) to enforce dark theme across the world wide web.

    html, #newtab-window {background: #020202 !important}
    * {color: #ddd !important; background-color: transparent !important;}
    img {opacity: .7 !important; transition: opacity .2s}
    img:hover, a:hover img {opacity: 1 !important; background-color: #bbb !important}

    Surprisingly 90% of internet works quite well with this. But there are the occasional websites that force white background via !important. Example is What is difference of using string as hardcoded value vs string constant[^] with this style entry:

    .container-entry {background-color: #fff !important;}

    Please reserve !important only for your developers or end-users, but never in production. PS: Your the first website I decided to actually tell of such usage. Also I think dedicated "dark modes" is generally a waste. As those are still something you must explicitly look for and enable. Whereas end-user CSS customizations apply implicitly and globally.

    C 1 Reply Last reply
    0
    • M Member_14801643

      I like using custom CSS stylesheets (via Stylus Add-on) to enforce dark theme across the world wide web.

      html, #newtab-window {background: #020202 !important}
      * {color: #ddd !important; background-color: transparent !important;}
      img {opacity: .7 !important; transition: opacity .2s}
      img:hover, a:hover img {opacity: 1 !important; background-color: #bbb !important}

      Surprisingly 90% of internet works quite well with this. But there are the occasional websites that force white background via !important. Example is What is difference of using string as hardcoded value vs string constant[^] with this style entry:

      .container-entry {background-color: #fff !important;}

      Please reserve !important only for your developers or end-users, but never in production. PS: Your the first website I decided to actually tell of such usage. Also I think dedicated "dark modes" is generally a waste. As those are still something you must explicitly look for and enable. Whereas end-user CSS customizations apply implicitly and globally.

      C Offline
      C Offline
      Chris Maunder
      wrote on last edited by
      #2

      I'm flattered we're the first! We're currently redoing our CSS from the ground up so things like this will be corrected. We may also add a Dark mode (to be decided). For me it's not a waste if there are specific colours we wish to use in a dark mode to ensure branding and display look good. It also saves people having to worry about their own custom styles. Plus, it's a CSS thing now (sorta).

      cheers Chris Maunder

      1 Reply Last reply
      0
      Reply
      • Reply as topic
      Log in to reply
      • Oldest to Newest
      • Newest to Oldest
      • Most Votes


      • Login

      • Don't have an account? Register

      • Login or register to search.
      • First post
        Last post
      0
      • Categories
      • Recent
      • Tags
      • Popular
      • World
      • Users
      • Groups