4 replies [Last post]
DeeL75
DeeL75's picture
User offline. Last seen 1 year 24 weeks ago. Offline
newbie
Timezone: GMT-7
Joined: 2010-08-17
Posts: 2
Points: 5

Hi folks,

I apologize ahead of time, if this is considered a newbie question and therefore should have been in the beginners section, but here goes...

I've just read an article on OOCSS and I noticed that the CSS sheet included ">" in the coding. If I understand the concept correctly #container > header means use this style for the tag <header> within the div with the ID "container".

I guess my question is what exactly does ">" mean and why do this? Wouldn't it be the same thing as creating a div with an id "header" and applying a style to it? Is it mainly to cut down on code? Or is it so that you can create your own tag, ie <header>? Or is this a CSS3 thing? (I haven't really touched CSS3 yet since I'm waiting for it to be standardized within the community.)

Thank you ahead of time,

Diane

Verschwindende
Verschwindende's picture
User offline. Last seen 5 days 11 hours ago. Offline
rank Guru
Guru
Timezone: GMT-5
Joined: 2009-10-09
Posts: 2037
Points: 2256

Google "Child Combinator".

Google "Child Combinator".

yet again.

Tyssen
Tyssen's picture
User offline. Last seen 20 hours 29 min ago. Offline
rank Moderator
Moderator
Timezone: GMT+10
Joined: 2004-05-01
Posts: 8123
Points: 1302

The child combinator only

The child combinator only targets immediate children so #container > header would match

<div id="container">
<header></header>
</div>

but not

<div id="container">
<section>
<header></header>
</section>
</div>

How to get help
Post a link. If you can't post a link, jsFiddle it.
My blog | My older articles | CSS Reference

DeeL75
DeeL75's picture
User offline. Last seen 1 year 24 weeks ago. Offline
newbie
Timezone: GMT-7
Joined: 2010-08-17
Posts: 2
Points: 5

Tyssen, Thank you so much for

Tyssen,

Thank you so much for the detailed reply.

Now I understand. Big smile

Hugo
Hugo's picture
User offline. Last seen 9 hours 31 min ago. Offline
rank Moderator
Moderator
Joined: 2004-06-06
Posts: 15095
Points: 2190

However I do hope that you

However I do hope that you did first try googling and spending a little time on study? Don't simply rely on us for answers to questions like this Smile

Before you make your first post it is vital that you READ THE POSTING GUIDELINES!
----------------------------------------------------------------
Please post ALL your code - both CSS & HTML - in [code] tags
Please validate and ensure you have included a full Doctype before posting.
Why validate? Read Me