{"id":14162,"date":"2011-09-06T19:52:30","date_gmt":"2011-09-07T02:52:30","guid":{"rendered":"http:\/\/css-tricks.com\/?page_id=14162"},"modified":"2016-01-12T13:48:59","modified_gmt":"2016-01-12T20:48:59","slug":"child","status":"publish","type":"page","link":"https:\/\/css-tricks.com\/almanac\/selectors\/c\/child\/","title":{"rendered":"Child"},"content":{"rendered":"

A child combinator in CSS is the “greater than” symbol, it looks like this:<\/p>\n

ol > li {\r\n  color: red;\r\n}<\/code><\/pre>\n

It means “select elements that are direct descendants only”. In this case: “select list items that are direct descendants of an ordered list”. To illustrate:<\/p>\n

<ol>\r\n  <li>WILL be selected<\/li>\r\n  <li>WILL be selected<\/li>\r\n  <ul>\r\n     <li>Will NOT be selected<\/li>\r\n     <li>Will NOT be selected<\/li>\r\n  <\/ul>\r\n  <li>WILL be selected<\/li>\r\n<\/ol><\/code><\/pre>\n

Try removing the ><\/code> symbol when playing around with the demo below:<\/p>\n

See the Pen f149edb15c53d157a7009b816ee919d2<\/a> by CSS-Tricks (@css-tricks<\/a>) on CodePen<\/a>.<\/p>\n

More Information<\/h3>\n