Az oldal korlátolt funkcionalitással fog rendelkezni, amíg elvégezzük a felhasználói élményt javító karbantartást. Ha egy leírás nem oldja meg a problémáját, és kérdést tenne fel, akkor a támogatási közösségünk a @FirefoxSupport Twitter oldalon tud segíteni, vagy az /r/firefox oldalon a Redditen.

Támogatás keresése

Kerülje el a támogatási csalásokat. Sosem kérjük arra, hogy hívjon fel egy telefonszámot vagy osszon meg személyes információkat. Jelentse a gyanús tevékenységeket a „Visszaélés bejelentése” lehetőséggel.

További tudnivalók

A témacsoportot lezárták és archiválták. Tegyen fel új kérdést, ha segítségre van szüksége.

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

  • 4 válasz
  • 1 embernek van ilyen problémája
  • 2 megtekintés
  • Utolsó üzenet ettől: 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

Összes válasz (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

Módosította: 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..