English | 简体中文 | 繁體中文 | Русский язык | Français | Español | Português | Deutsch | 日本語 | 한국어 | Italiano | بالعربية

CSS Reference Manual

CSS @Rule (RULES)

Complete List of CSS Properties

CSS Nested Selector

Complete CSS Selector Reference Manual

Online Example

Select all <p> elements within the <div> element:

!DOCTYPE html>
<html>
<title>Basic Tutorial Website (oldtoolbag.com)</title>
<head>
<style>
div p
{
background-color:red;
color:white;
}
</style>
</head>
<body>
<h1>Welcome to Basic Tutorial Website (www.oldtoolbag.com)</h1>
<div>
<p>The URL of our website is: www.oldtoolbag.com.</p>
<p>The name of our website is: Basic Tutorial Website.</p>
<span>Demonstrate nested selector<!/span>
</div>
<p>We provide various basic tutorials for you to learn. Learn the basics well, and you can go further!<!/p>
</body>
</html>
Test and See ‹/›

Definition and Usage

Nested selector element element is used to select elements inside elements.

Browser Compatibility

IEFirefoxOperaChromeSafari

All mainstream browsers supportelement,elementSelector.

Complete CSS Selector Reference Manual