CSS descendant combinator ( )

definition and usage

CSS descendant combinator (a simple space) is used to select elements within another element.

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

example

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

div p {
  background-color: yellow;
{}

try it yourself

CSS syntax

element1 element2 {
  css declarations;
{}

technical details

version: CSS1

browser support

Chrome Edge Firefox Safari Opera
Support Support Support Support Support

Relaterede sider

CSS tutorial:CSS efterkommere selektor