this post was submitted on 02 Nov 2024
21 points (100.0% liked)
Firefox
20907 readers
8 users here now
/c/firefox
A place to discuss the news and latest developments on the open-source browser Firefox.
Rules
1. Adhere to the instance rules
2. Be kind to one another
3. Communicate in a civil manner
Reporting
If you would like to bring an issue to the moderators attention, please use the "Create Report" feature on the offending comment or post and it will be reviewed as time allows.
founded 5 years ago
MODERATORS
you are viewing a single comment's thread
view the rest of the comments
view the rest of the comments
Right,
background-color
is not an inherited property (compared to for examplecolor
(color of text) which is). But even if it were, inheritance is not "enforced" so if website css sets a backround-color specifically for that element then the inherited value would be lost anyway.But the way you now describe it doesn't seem possible. There is not syntax to apply style rule to "just the innermost element". I think the closest would be to have everything else have fully transparent background, but the html root element have only partial transparency:
However, you will still face a problem; many websites draw graphics or images as a
background-image
so if you use thebackground
shorthand property then those graphics will be effectively removed. On the other hand, if you instead set justbackground-color
then parts might get opaque again because a website could be drawing even opaque backgrounds as background-image instead of background-color.You're right about the background. That was me going catch-all while testing. I'll set background-color only for a while and observe how that works.
I assumed background-color would be inherited when marked
!important
since I haven't seen that noted anywhere on MDN or similar.Yeah,
!important
doesn't affect inheritance in any way. It only means that this particular rule is to be used if there are multiple rules that would set that particular property for the element in question (unless there's some other more specific rule with !important tag as well). MDN lists property inheritance in the formal definition section. You can totally make background-color inherited though - like*{ background-color: inherit }
(and then set the property to something else on the root element from which you would want to inherit from) but it would then either not apply if website set it to anything else for an element or override any other set value if you used!important
tag.One other thing worth noting is that I would not recommend the rules mentioned for userChrome.css to be used as is - at least on Windows they completely break Firefox startup - it fails to display any window if you do that. Instead you should add a
[sessionrestored]
selector to wait a bit before those rules are applied to main-window: