Jump to content

some basic css rule


giovanni

Recommended Posts

hi guys, first sorry for my ad english, i'm a newbie about css and i need an help about some rule: what is the difference betwwen these two rules? html {padding:0px; margin:0px} body{padding:0px; margin:0px} the intepretation of this ruls div#extra div.newsbox p{margin: 0} is all paragraph inside div with class newsbox internal to div with id equal to extra has all margin set to zero is correct tanksGiovanni

Link to comment
Share on other sites

(1) html{[...]}, sets zero margin/padding for the <html> element, while body{[...]}, sets it for the <body> element.(2)

div#extra div.newsbox p{[...]}

Any <p>, inside a <div> with id="newsbox", and the <div> with id="newsbox", is also inside another <div>, with class="extra".

Edited by eTianbun
Link to comment
Share on other sites

You mixed up the class and ID selectors there. A hash # is the ID selector while a dot . is a class selector. A space between two selectors means that the selector on the right is a descendent of the selector on the left.

  • Like 1
Link to comment
Share on other sites

You mixed up the class and ID selectors there. A hash # is the ID selector while a dot . is a class selector. A space between two selectors means that the selector on the right is a descendent of the selector on the left.
Opse, my bad! I use mobile phone, so i find it difficult to spot error(s) sometimes, thats why i always edit my post... Thanks for that :)
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...