CSS 类型选择器
英文:type selector
或 element selector
.
CSS 类型选择器通过节点名称匹配元素。换句话说,它选择一个文件中所有给定类型的元素。
例子
html {color: black;}
h1 {color: gray;}
h2 {color: silver;}
完整示例
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="content-type" content="text/html; charset=utf-8" />
<title>Simple styling of a simple document</title>
<style type="text/css">
html {color: black; background-color: white; }
h1 {color: gray;}
h2 {color: silver;}
</style>
</head>
<body>
<h1>Plutonium</h1>
<p>
Useful for many applications, plutonium can also be dangerous if improperly handled.
</p>
<h2>Safety Information</h2>
<p class="warning">When handling plutonium, care must be taken to avoid
the formation of a critical mass.</p>
<p>With plutonium, <span class="warning">the possibility of implosion is
very real, and must be avoided at all costs</span>. This can be accomplished
by keeping the various masses separate.</p>
<h3>Comments</h3>
<p>
It’s best to avoid using plutonium <b>at all</b> if it can be avoided.
</p>
</body>
</html>