CSS 中的元素类型选择器

cssweb developmentfront end technology更新于 2025/1/19 5:00:17

CSS 元素类型选择器用于选择某一类型的所有元素。CSS 元素类型选择器的语法如下

语法

element {
   /*declarations*/
}

示例

以下示例说明 CSS 元素类型选择器

<!DOCTYPE html>
<html>
<head>
<style>
li {
   list-style: none;
   margin: 5px;
   border-bottom-style: dotted;
}
div {
   box-shadow: inset 0 0 8px plum;
   padding: 36px;
}
</style>
</head>
<body>
<div>
<pre> \(╪)(╪) /</pre>
<ul>
<li></li>
<li></li>
</ul>
</div>
</body>
</html>

输出

这将给出以下输出 −

示例

<!DOCTYPE html>
<html>
<head>
<style>
li {
   text-align: center;
   list-style: none;
   margin: 5px;
   padding: 5px;
   box-shadow: inset 0 0 15px yellowgreen;
}
div {
   box-shadow: inset 0 0 8px orange;
   padding: 36px;
   width: 30%;
   border-radius: 50%;
}
</style>
</head>
<body>
<div>
<ul>
<li>Hello</li>
<li>Guys</li>
</ul>
</div>
</body>
</html>

输出

这将给出以下输出 −


相关文章


有用资源