question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Why so many !important css declarations?

See original GitHub issue

I need to set some of the basic colors of items to our corporate design system colors.

In 3.x this was not an issue, set up our custom _variables.scss and remap the colors.

But I keep running into roadblocks with classes like .bg-primary or .text-info to name two: these are set in the Bootstrap scss with !important declarations forcing me to redefine the style and also add !important.

Why all the !importantss?

Issue Analytics

  • State:closed
  • Created 6 years ago
  • Reactions:8
  • Comments:10 (4 by maintainers)

github_iconTop GitHub Comments

22reactions
mdocommented, Jul 4, 2017

Sorry, @smlombardi, but this was the direction we decided to take years ago. We’re kinda locked into it now. Plus, most folks asked us for !important on these utilities.

16reactions
mdocommented, Jun 14, 2017

They’re there to ensure you can apply those styles as utilities no matter what. It’s a necessary evil that’s only present for utility classes, and nothing else.

You don’t have to rely on the included custom Sass file (I think I’m going to nuke that damn thing at this point, it’s way too confusing).

Read more comments on GitHub >

github_iconTop Results From Across the Web

When and why to use the CSS !important declaration
!important in CSS is a special notation that we can apply to a CSS declaration to override other conflicting rules for the matching...
Read more >
CSS is !important - Medium
Cascading Style Sheets are designed to, well, cascade. !important declarations overrides the cascading nature of CSS and are often ...
Read more >
important - CSS: Cascading Style Sheets - MDN Web Docs
A ! delimiter followed by the important keyword marks the declaration as important. The !important flag alters the rules selecting ...
Read more >
Priority of CSS declarations. A smart way to avoid !important
User declarations are the ones that the user of the browser makes, for example, if he changes the default font that the browser...
Read more >
Everything You Need to Know About !important CSS ...
An !important declaration that is defined in a user style sheet will have more weight than one defined in an author style sheet...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found