-
Notifications
You must be signed in to change notification settings - Fork 312
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Set background on body instead of html? #42
Comments
Alternative suggestion: Removing the |
"Back in the day", we used to always set background/foreground colors for the page as it was easy for the user (in Internet Explorer at least) to change the page's background color. Back then, authors could not assume |
Yeah, that’s still possible. But only if you force it. And if someones forces it, your setting in the CSS won’t matter anyway. |
No, this was (is?) not the same as styles from a user styles sheet, this background setting was overwritten by a simple:
There was no need for |
This has nothing to do with a user stylesheet, it's an accessibility feature (by Internet Explorer). For example, http://dabblet.com/gist/d0f8d05938464a257e8d shows a beautiful red. If I enable "Ignore colors specified on webpages" (under Accessibility), the colors defined under "Colors" is used. |
Isn't exactly what I said?
And if the author's styles sheet does not define any color, then the color set via "Internet Options > Colors > Background" is used--which is exactly what I'm saying here. |
Not setting a background color also has issues if the site is ever put in an |
Which defaults to If you remove this option, yes, the default white background is gone. It's probably like 1 of 100k - and he might want it. But who am I to judge, right? Anyway, the iframe issue changes everything. I can't remember the last time I had to use an iframe for my page, but in this case I'd go with the color on body. |
Yes, we are talking about custom settings here, meaning the user would change that option to get the background of her choice.
Yeah, that's a good call by @tigt |
+1 for removing $html-background-color |
This is done to enforce contrast. Anytime the YIQ contrast might change due to changing the text This is a better standard. The overflow of the If I switch to CSS4, perhaps I could define a custom element like |
This is not buggy/legacy-ridden, this is per spec. 3.11.2. The Canvas Background and the HTML Element says:
In other words, user agents must propagate the background of What's wrong with setting |
A custom element could allow developers to choose, rather than possibly turning this into a tabs vs spaces thing. As far as the spec is concerned, sometimes it is just there to document legacy behavior. |
What are the advantages of styling |
Styling the entire canvas color of a page is a job for Normalize did this for some time before Necolas determined it might not be possible to safely address the problem that it was trying to avoid. This is due to a great misunderstanding of
Could you imagine if we had let |
Why? What's wrong with using
Not when it comes to its background and section 3.11. Backgrounds of Special Elements is very clear about this. If we consider content to be within
Yahoo was wrong. I opened a bug there and the background declaration was supposed to be moved to
Sorry, I don't see the relevance here... Anyway, feel free to close this issue as you really seem to be opposed to the idea. |
I’m actually considering changing it, but you did ask me to present my case. I think the spec comes across rather confused on this subject.
An inspector tool seems to indicate this is
Well, no explicit element...
And
What? Okay, let’s understand this 180 in the description below.
That’s us.
Okay, if no background is assigned to
Got it. If
Again, seems pretty straight forward. It’s like we are forwarding
What? This feels like another 180. And then I find no explanation. It’s concerning. Your argument, @thierryk, is the best and strongest I’ve heard.
Unless a spec author validates my theory that the spec recommendation is out of place because it addresses legacy behavior, I’ll change this soon. I certainly won’t leave a long window open for this. Somewhat related; if and when I change it, would this be considered a major or minor change to Sanitize? I find semver to be tricky business with CSS. |
I agree about semver and CSS as "base" styles sheets dictate more or less the styles found in authored styles sheets. Meaning almost any change in a "base" styles sheet has the potential to break a page. In our case, things will break if authors have customized (overwritten) the background of their page by styling |
I know how to resolve this issue, at least for those using the cssnext version. /* sanitize.css */
@custom-selector :--root :root;
:--root { /* sanitize.css styles */ }
/* user stylesheet */
@custom-selector :--root body; I will make this part of the next release. |
For what it is worth, I think this should not be labelled as a enhancement but as a bug since it goes against best practice. |
We’re not styling background or color for the page, so we don’t need to worry about this anymore. |
Setting a background color on
html
instead of onbody
may confuse people as it will make the latter "shrink" vertically--as this demo shows.May be better/safer to style
body
.The text was updated successfully, but these errors were encountered: