General Question

silverfly's avatar

What does background: transparent do in Eric Meyer's reset.css?

Asked by silverfly (4055points) December 3rd, 2010
4 responses
“Great Question” (0points)

In Eric Meyer’s reset.css, he adds a background: transparent to just about every HTML element available. I’d like to know why.

Observing members: 0
Composing members: 0

Answers

Vortico's avatar

This is used to override any unexpected browser defaults of an opaque background on an element such as <input>. I wouldn’t worry too much about it since it was added to fix unusual browser settings.

funkdaddy's avatar

transparent is a valid “color” for the background.

So it would really fill the background-color: declaration more specifically and basically is just a version of “none”

silverfly's avatar

Awesome, that makes sense. Thanks guys. (or gals)

ETpro's avatar

As @Vortico notes, if it has precedence in the cascade, it may be to override an earlier background color assignment. Also, the W3C validator issues a warning on elements where the color is explicitly stated but the background is not. This isn’t really an error. It is just telling you that safest practice is to explicitly state both color and background where one is stated. Transparent is the default, so doesn’t really need to be stated unless overriding some assignment further up the cascade, but stating it anyway gets rid of lots of warnings in the validation report, and thus makes zeroing in on real problems far easier. I always state it for just that reason.

Answer this question

Login

or

Join

to answer.

Mobile | Desktop


Send Feedback   

`