Skip to content
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

Normalize body background #170

Closed
ProgerXP opened this issue Mar 26, 2013 · 26 comments
Closed

Normalize body background #170

ProgerXP opened this issue Mar 26, 2013 · 26 comments
Labels

Comments

@ProgerXP
Copy link

Not sure if this issue is within normalize.css' idea but nevertheless. I suggest that body gets background: white because by default, or at least in Firefox it's transparent. This means it's filled with system-default color (clWindow?) which by default is white but depends on user's theme. I was surprised when a visitor sent me a screenshot with my design filled with gray instead of white which made the page look entirely different.

@tharri
Copy link

tharri commented Mar 26, 2013

Was it Firefox 3? Normalize v2 no longer addresses issues with ancient browsers like FF3.

@drgullin
Copy link

Background of the body should probably be white. Just because it can be different for custom Windows color schemes.

@ProgerXP
Copy link
Author

My bad, it wasn't Firefox but Opera (either 10 or 11). I couldn't reproduce it even after tweaking its settings. However, I could do the same thing with IE 8 (XP): change Display Properties > Appearance. Here's the test code:

<!DOCTYPE html>
<html>
  <head>
    <link href="http://necolas.github.com/normalize.css/2.1.0/normalize.css" rel="stylesheet">
  </head>
  <body>
  </body>
</html>

Here's the screenshot: http://i.imgur.com/cnWqymT.png

@andrejcremoznik
Copy link

I'd recommend the same also for form elements not just body. Thank you for addressing this.

@necolas
Copy link
Owner

necolas commented Mar 28, 2013

I'd recommend the same also for form elements

Why? I don't make any changes without test cases and being able to assess the consequences of a change.

@andrejcremoznik
Copy link

Fair enough. Here's a fiddle with normalize loaded as an external resource: http://jsfiddle.net/dUftD/

I'm on Linux with KDE desktop using a dark color scheme.

Rekonq (webkit-qt browser) - my default:
css_background_rekonq

Opera (12.14):
css_background_opera

Firefox (19):
css_background_firefox

Chrome (25):
css_background_chrome

The results are all over the place.

  • Rekonq has black text, which is IMHO a browser bug, because it doesn't respect the system's scheme.
  • Firefox follows the system's color scheme, and is perfect. The problem is with web developers often setting a dark, non-black color for inputs and forgetting about background, leaving me with dark text on dark background.
  • Chrome doesn't respect the system default at all and therefore kind of amends for web dev's mistakes.
  • Opera is the same as Firefox and also suffers from the same problem

Maybe this isn't something for normalize to solve, because it's a problem with web developers not being aware of those issues. That's why I subbmitted the pull request to H5BP, because I believe it should apply downstream.

@ProgerXP
Copy link
Author

Agree with @andrejcremoznik, I have seen the same problem with form elements (at least input, textarea and select). It looks sensible if we're normalizing body to black on white then we normalize other elements to black on white as well.

@necolas
Copy link
Owner

necolas commented Mar 29, 2013

I'd rather add a background color to html. Does that also fix your problem @andrejcremoznik?

@andrejcremoznik
Copy link

I'd rather add a background color to html. Does that also fix your problem @andrejcremoznik?

Setting background on html does not affect form elements. Here's my test file: https://gist.github.com/andrejcremoznik/5273600

I'm seeing the same inconsistencies as with the fiddle above.

@tomByrer
Copy link

I assume that this will fix your issue @andrejcremoznik? Can you think of other sneaky wrong backgrounds? Glad you are testing things out!

button,
input,
select,
textarea {
    color: inherit; /* 1 */
}

@necolas
Copy link
Owner

necolas commented Mar 29, 2013

@andrejcremoznik I'm not asking about the form elements, I mean the issue with the full page background color. Thanks.

@necolas
Copy link
Owner

necolas commented Mar 29, 2013

Let's keep this issue focused on page background. There's already an issue about form text color inheritance. Thanks

@andrejcremoznik
Copy link

background alone on html is insufficient. For some reason Firefox applies a light text color to regular text. Adding color property, however, fixes all inconsistencies I could find.

@necolas
Copy link
Owner

necolas commented Mar 30, 2013

All I want to know is if background on html fixes the whole-page background issue that is the subject of this ticket. Are you saying it does?

@andrejcremoznik
Copy link

Yes, it makes the background white everywhere.

But that alone does not solve the issue. Text color as well needs to be "normalized".

@necolas
Copy link
Owner

necolas commented Mar 30, 2013

For some reason Firefox applies a light text color to regular text.

To what, form text? What element are you saying color needs to be normalized on?

@andrejcremoznik
Copy link

For some reason Firefox applies a light text color to regular text.

To what, form text? What element are you saying color needs to be normalized on?

I stopped talking about form elements 5 replies ago. Is my english that bad?

I'm saying you should do this:

html {
  ...
  color: black;
  background: white;
}

@ProgerXP
Copy link
Author

@necolas, what's the problem with the solution suggested by @andrejcremoznik for html? And why not normalize form elements in this ticket as well if it's clear that browsers color them differently, as demonstrated? I don't understand the hassle.

@tomByrer
Copy link

To what, form text? What element are you saying color needs to be normalized on?

I stopped talking about form elements 5 replies ago. Is my English that bad?

I personally assumed you were still talking about form elements; you did not specifically say "the entire webpage". Nor do I see any screenshots that prove "For some reason Firefox applies a light text color to regular text."; I only see screenshots about forms.

Perhaps Firefox-Linux renders text differently than other Linux browsers? Here is a blog about Firefox-Windows anti-aliasing rendering changes that may give insight.

@necolas
Copy link
Owner

necolas commented Mar 31, 2013

Please could I see a screenshot of the text color problem in Firefox: "For some reason Firefox applies a light text color to regular text." - I'd like to understand what this means and how it happens.

It would be great if you can also mention the version of Firefox, the OS, and whatever else it is that causes the issue. At the moment, due to some earlier confusion, I still don't have a clear picture of exactly is the text color problem and when it happens.

Thanks

why not normalize form elements in this ticket

Because that's a separate issue.

@ProgerXP
Copy link
Author

Alright then. Same IE 8, same XP SP 3. Code from my second post (#170 (comment)).

Without normalization: http://i.imgur.com/g7qjbws.png

With normalization of html: http://i.imgur.com/bp1P0ee.png

Is this enough?

@FagnerMartinsBrack
Copy link

I have never heard of any user changing their background theme at the point of mess with a web page. The developer will never see this coming indeed.

I am impressed how just now this has brought into attention (it makes me think if this behavior is common enough for the need of normalization...)

@andrejcremoznik
Copy link

This is the test file I'm using: https://gist.github.com/andrejcremoznik/5273600

Firefox (html { background: white }):
css_background_ff

Firefox (html { background: white; color: black }):
css_background_ff1

Firefox (without background and color):
css_background_ff2

As said before, I'm on linux, KDE, dark color scheme:
kde_colors

@tomByrer
Copy link

tomByrer commented Apr 1, 2013

Great tests guys, thanks! Do my changes seem to work for you please? Direct-link minified, source

@necolas
Copy link
Owner

necolas commented Apr 1, 2013

Thanks, that's helped clear things up a lot.

necolas added a commit that referenced this issue Apr 1, 2013
System color schemes (in particular, custom themes in Windows and Linux
distros) affect Firefox, IE, and Opera. Normalizing the web site/app's
root background and text color prevents these unwanted settings from
being used. Chrome doesn't apply system-level schemes to websites.

Fix gh-170
@necolas necolas closed this as completed in 9078909 Apr 1, 2013
@ProgerXP
Copy link
Author

My bad, it wasn't Firefox but Opera (either 10 or 11). I couldn't reproduce it even after tweaking its settings.

Just wanted to mention that I got this issue showing up in Opera 11.61 (turns out it applies appearance settings only after restart): http://i.imgur.com/olUlC8I.png using my earlier empty document (#170 (comment)). This is of course no more the case with 2.1.1.

kvakes pushed a commit to imvu/normalize.css that referenced this issue Jul 3, 2013
System color schemes (in particular, custom themes in Windows and Linux
distros) affect Firefox, IE, and Opera. Normalizing the web site/app's
root background and text color prevents these unwanted settings from
being used. Chrome doesn't apply system-level schemes to websites.

Fix necolasgh-170
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

7 participants