Click to See Complete Forum and Search --> : Selector Syntax Question


Thehappyhack
07-27-2009, 03:54 PM
Hello:

This is a fairly elementary question, but I am a beginner...

What is the difference between?:

#headerdiv > p {

and p#headerdiv {

In the first case I am only styling the element of a direct child. What am I doing in the second example? Is it not the same thing?

Thank you,

Greg

1DayTutoring
07-27-2009, 06:22 PM
#headerdiv > p {
targets all paragraphs that are direct child of the #headerdiv container.
whereas p#headerdiv { means a paragraph with an ID #headerdiv

The two selectors are different.