CSS Descendant Combinator ( )

Definition and Usage

CSS Descendant Combinator (A simple space) is used to select elements within an element.

If the element matched by the second selector has an ancestor (parent element, parent's parent element, etc.) that matches the first selector, then these elements will be selected.

Example

Select and set the style of all <p> elements within the <div> elements:

div p {
  background-color: yellow;
}

Try It Yourself

CSS Grammar

element1 element2 {
  css declarations;
}

Technical Details

Version: CSS1

Browser Support

Chrome Edge Firefox Safari Opera
支持 支持 支持 支持 支持

相关页面

CSS 教程:CSS 后代选择器