ISSUE :
 
Profile photo
Submitted by Sam Buchana
on August 17th, 2012 at 09:22:37 EST

what is greater than sign > in CSS

What is greater than sign > in CSS (Cascading style sheet)? I see this being used in one of the example that I am looking into.


Profile photo
Replied by SBajra
on August 17th, 2012 at 13:06:48 EST
Greater than sign ">" in CSS is Child selector.

For example:
if you have style like:

div > span
{
color:#336699;
}


and if your HTML is:

<div>
<span>Text one</span>
<p><span>Text two</span></p>
</div>


In this example, color style will be applied only to direct descendants of <div> tag which is <span> tag with text "Text one". color style will not be applied to <span> under <p> tag because it is not direct descendant of <div> tag.
Accepted Answer
Accepted
 Answer