0

font-size CSS rule defined by class rule (.dropdown-menu) was overridden by build-in browser element rule (table). How is that possible?

I work on Cockpit plugin that uses PatternFly styles. My label element (selected line in screenshot) has too large font-size that was inherited from indirect parent element table. The table surprisingly doesn't inherit value of property font-size from its parent elements (defined for div.dropdown in .dropdown definition) however it takes it directly from browser stylesheet. I wonder how is it possible, doesn't it violate CSS cascade - to use browser definition instead on inherit from parent element?

It works this way consistently in Chrome 51 and Firefox 46.

Dev tools screenshot

Here is simplified JsFiddle demo that seems to work correctly (i.e. differently).

According to w3schools font-size rule is inherited and according to css specification browser styles should have lower priority.

czerny
  • 15,090
  • 14
  • 68
  • 96
  • Check to see if you're in quirksmode, which could be causing this inheritance issue. If you're in strict mode, this should not be occurring. – Andy Hoffman Jun 09 '16 at 17:34
  • `document.compatMode` returns `CSS1Compat` thus I guess it's in strict mode (according to http://stackoverflow.com/a/627124/639687). Now I probably miss something about how css rules are applied. Can you please explain why the `font-size` value was picked from browser style sheet instead of inherited? And compare it to the linked JsFiddle example where it was not? – czerny Jun 09 '16 at 17:44
  • @AndyHoffman You were right, it was a quirks mode in iframe. That's why root document's `compatMode` returned `CSS1Compat`. Thank you for a hint. Would you like to put it in an answer I can accept? – czerny Jun 16 '16 at 00:31
  • Done. Thanks, @czerny. – Andy Hoffman Jun 16 '16 at 00:38

1 Answers1

1

Check to see if you're document is in quirksmode, which could be causing the inheritance issue. If the document is in strict mode, this should not be occurring.

Andy Hoffman
  • 18,436
  • 4
  • 42
  • 61