tags:

views:

142

answers:

2

I'm trying to access the h1 element inside a div with an id of "header".

Should I use

#header h1

or

#header.h1
+1  A: 
#header h1

if you add point before the meaning is this is a class name

help link :

http://www.w3schools.com/CSS/css_syntax.asp

Haim Evgi
+12  A: 
#header h1

Means "all h1 elements that are descendants of the element with the id "header" (you probably want this one).

#header.h1

Means "the element with the id "header" that also has the class name h1" (you definitely don't want this one).

#header > h1

Means "all h1 elements that are direct children of (i.e., directly underneath) the element with the id "header". This type of selector is not supported by IE6. This one may work but you probably want the first one.

Matt Bridges
Awesome! Thanks.
brian
great reference.
phsr