css-selector
CSS * Selector (Priority 12 (after short code))
The * (asterisk) selector selects all elements in a document. (* (星号)选择器选择文档中的所有元素。)
The * selector can also select all elements inside another element. (*选择器还可以选择另一个元素内的所有元素。)
Version
Version (版本)
CSS2 Universal Selector (CSS2通用选择器)
Syntax
Syntax (语法)
* {
css declarations;
}
Example of the * selector:
<!DOCTYPE html>
<html>
<head>
<title>Title of the document</title>
<style>
* {
background-color: #8ebf42;
}
</style>
</head>
<body>
<h2>* selector example</h2>
<div class="example">
<p id="example1">Lorem ipsum is simply dummy text...</p>
<p id="example2">Lorem ipsum is simply dummy text...</p>
</div>
<p>Lorem ipsum is simply dummy text...</p>
</body>
</html>
Example of the * selector for a <div> element:
<!DOCTYPE html>
<html>
<head>
<title>Title of the document</title>
<style>
div * {
background-color: #8ebf42;
}
</style>
</head>
<body>
<h2>* selector example</h2>
<div class="example">
<p id="example1">Lorem ipsum is simply dummy text...</p>
<span id="example2">Lorem ipsum is simply dummy text...</span>
</div>
<p>Lorem ipsum is simply dummy text...</p>
</body>
</html>