Search Support

Avoid support scams. We will never ask you to call or text a phone number or share personal information. Please report suspicious activity using the “Report Abuse” option.

Learn More

Why inline css property with !important not override the class property in firefox ?

  • 4 ప్రత్యుత్తరాలు
  • 1 ఈ సమస్య కలిగినది
  • 2 వీక్షణలు
  • చివరి సమాధానమిచ్చినది cor-el

more options

Why inline css property with !important not override the class property in firefox ?

We try to replicate the same thing in Chrome and there it overrides correctly but in firefox it shows problem

Let me try to clear the scenario

we have a class

.top-container { display: none !important }

and on element we add style

element.style. display = 'block !important;'

but it don't show the element. While in Chrome (OS MAC) it work fine

My System Configuration

OS - MAC

Firefox Version - Firefox 59.0.2.dmg

There is some issue in attaching snapshot. So I put a stackoverflow link where snapshots are present. Please have a look

https://stackoverflow.com/questions/49760154/is-there-anyway-that-inline-css-property-with-important-not-override-the-class

Why inline css property with !important not override the class property in firefox ? We try to replicate the same thing in Chrome and there it overrides correctly but in firefox it shows problem Let me try to clear the scenario we have a class .top-container { display: none !important } and on element we add style element.style. display = 'block !important;' but it don't show the element. While in Chrome (OS MAC) it work fine My System Configuration OS - MAC Firefox Version - Firefox 59.0.2.dmg There is some issue in attaching snapshot. So I put a stackoverflow link where snapshots are present. Please have a look https://stackoverflow.com/questions/49760154/is-there-anyway-that-inline-css-property-with-important-not-override-the-class

ప్రత్యుత్తరాలన్నీ (4)

more options

Please always check your code with upload or direct URL link with W3C.org (World Wide Web Consortium) in charge of standards and practices and future development of web pages and web browsers make the rules on code. Mozilla Firefox follows these rules. W3C.org Who make the rules for web code. HTML https://validator.w3.org/ CSS https://jigsaw.w3.org/css-validator/ and https://validator.w3.org/i18n-checker/ and http://mobile.css-validator.org/

more options

Hi , I read those rules that's why I am asking why it behave differently.

Is there any bug in firefox, may be due to long selector ? 

If you need more details to reproduce this bug please let me know

న abhaygarg12493 చే మార్చబడినది

more options

Hi if you have the page up and running some where please supply the URL and someone will look at all your code that knows more than I. As the error may not be where you think it is. Meta tag it with No robots, no index and we can see it while others will not.

Staying away from Moz work arounds is always the best.

I will forward this question now as it stands.

more options

Any special reason for using the !important flag since that will possibly makes it less easy to override CSS properties?

The Specificity of a class might be higher than an inline rule and you may not be able to override it..