Click to Rate and Give Feedback
MSDN
MSDN Library
Web Development
Internet Explorer
Selectors
Combinators
 Child (>) combinator
Child (>) combinator

[This documentation is preliminary and is subject to change.]

Specifies an adjacent sibling relationship between selector elements.

CSS 2.1, Section 5.6

Syntax

first>second { ... }

Parameters

first

A CSS simple selector.

second

A CSS simple selector.

Standards information

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 not supported in webpages that are displayed in the Microsoft Internet Explorer 5 document mode (also known as "Quirks" mode). To use attribute selectors, add a !DOCTYPE directive that specifies a standards-based document. For more information, see Defining Document Compatibility.

Examples

The following style rule matches only p elements that are immediate children of the body element.

CSS
<!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>

 

 

Build date: 3/14/2012

Tags What's this?: Add a tag
Community Content   What is Community Content?
Add new content RSS  Annotations
IE7 does not support #id selector as a parent      Bkqc ... Green-D   |   Edit   |   Show History

In IE7 if you write something like

#TableId&;;gt;tr&;;gt;td:first-child{border:solid 1px black;}

it will not get recognized. You will have to write it as

#TableId tr&;;gt;td:first-child{border:solid 1px black;}

and hope that you don't have any other tr element embedded within another table


It is not a bug actually. You can not refer table > tr because there is a tbody tag.
So use table > tbody > tr.

Tags What's this?: Add a tag
Flag as ContentBug
Processing
© 2012 Microsoft. All rights reserved. Terms of Use | Trademarks | Privacy Statement
Page view tracker