tags:

views:

59

answers:

5

Are

    html, body, div, span, object, iframe, h1, h2, h3, h4, h5, h6, p, 
blockquote, img, strong, dl, dt, dd, 
ol, ul, li, fieldset, form {background:transparent;}

and

body {background:transparent;}

same thing?

+2  A: 

no becouse in second you define only background for body, so all the rest stay without changes

Dobiatowski
+3  A: 

No, body {} will just do body and no child elements. html{} is also the parent of body{}

This would select all of the children of the html element, although I don't think it would effect things such as h1, h2 etc, as they would be children of child elements etc.

html > * {background:transparent;}

Every reset stylesheet I have seen does what you have done in your first block of CSS. I think it is the only way to make sure you have selected all of the elements on the site.

danixd
`html > * {background:transparent;}' will it override on all other background defined in same css?
metal-gear-solid
+1  A: 

As far as body is concerned yes..

But the first case also makes background transparent all those other tags..

if you are looking for a shorthand then you could use the (warning:all inclusive)

body, body *{background:transparent}
Gaby
A: 

They're the same thing in as much as none of those elements have backgrounds anyway.

They'd only have any effect if they were overriding backgrounds set by previous rules, either earlier in your own stylesheet, or in a user's custom stylesheet.

I really wouldn't bother. It's resetting gone mad.

bobince
i'm using this `body {background:transparent;}` on a page which i'm using on another site as a `Iframe`. but background showing white in IE browser. and no other background color defined for any other element
metal-gear-solid
@metal-gear-solid: make sure the iFrame has the attribute allowtransparancy="true" eg <iframe src="foo.htm" allowtransparancy="true">
What
+1 what What said, only spelled `allowtransparency` :-)
bobince
A: 

no this is not same because


html, body, div, span, object, iframe, h1, h2, h3, h4, h5, h6, p, blockquote, img, strong, dl, dt, dd, ol, ul, li, fieldset, form {background:transparent;}

has separate style background:transparent


but in case of

body {background:transparent;}

inherited style background:transparent

ritesh choudhary