Child (>) Combinator
Specifies a direct descendant relationship between selector elements.

Syntax

HTMLE > F { sRules }
ScriptingN/A

Possible Values

EString that specifies the name of a document language element type or simple selector.
FString that specifies the name of a document language element type or simple selector.
sRulesString that specifies one or more Cascading Style Sheets (CSS) attribute/value pairs.

Remarks

A child combinator is a "greater-than sign" (>) character that separates two simple selectors. Whitespace is not significant. A selector of the form "E>F" matches when element F is a direct descendant of element E.

Note   Requires Windows Internet Explorer 7 or later.
Note   Combinators are enabled only in standards-compliant mode (strict !DOCTYPE).

Example

The following style rule matches only P elements that are immediate children of the BODY element.

<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.0 Strict//EN">
<html>
<head>
    <style>
        BODY > P { line-height: 1.3; color: red;}
    </style>
</head>
<body>
    <p>Paragraph one</p>
    <div><p>Paragraph two</p></div>
    <p>Paragraph three</p>
</body>
</html>

Standards Information

This selector is defined in CSS, Level 2 Revision 1 (CSS2.1).

See Also

Tags :


Page view tracker