*(星号)选择器选择文档中的所有元素。
* 选择器还可以选择另一个元素内的所有元素。
语法
* {
css declarations;
}
* 选择器示例:
<!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">把痛苦停在昨天 把微笑留给明天。</p>
<p id="example2">把痛苦停在昨天 把微笑留给明天。</p>
</div>
<p>Lorem ipsum is simply dummy text...</p>
</body>
</html>
<div> 元素的 * 选择器示例:
<!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">把痛苦停在昨天 把微笑留给明天。</p>
<span id="example2">把痛苦停在昨天 把微笑留给明天。</span>
</div>
<p>把痛苦停在昨天 把微笑留给明天。</p>
</body>
</html>
日期:2020-06-02 22:14:27 来源:oir作者:oir
