1 reply [Last post]
lynngrin
Offline
newbie
Last seen: 13 years 14 weeks ago
Joined: 2006-01-04
Posts: 9
Points: 0

Hello

I have so far not been able to find the reason for using the following prefix css coding, for example:

html > {

}

body > {

}

Could somebody please explain the purpose of the > prefix and how or why it is used.

Thanks in advance.

Regards
Lynn

wolfcry911
wolfcry911's picture
Offline
Guru
MA, USA
Last seen: 6 years 18 weeks ago
MA, USA
Timezone: GMT-5
Joined: 2004-09-01
Posts: 3224
Points: 237

what does this mean

Well your examples are incorrect, but it's the child selector. It's to target elements that are a direct child of the parent (not any deeper, like descendant selectors). For example:
div>strong {color: blue}will target the first example but not the second.

<div>Here comes <strong>Santa Claus</strong>.</div>

<div><p>With all of his <strong>reindeer</strong>and sleigh.</p></div>

IE will not recognize it, so it is sometimes used to feed modern browsers different information.