|
标记选择器和id选择器,其实第二个例子中,两个都用一个id的用法是错误的
<html><head><title>标记选择器.class</title><style type="text/css"><!--h4{/* 标记选择器 */color:red;font-size:18px;}h4.special{/* 标记.类别选择器 */color:blue;/* 蓝色 */font-size:24px;/* 文字大小 */}.special{/* 类别选择器 */color:green;}--></style></head><body><h4>标记选择器1.class1</h4><h4>标记选择器2.class2</h4><h4 class="special">标记选择器3.class3</h4><h4>标记选择器4.class4</h4><h4>标记选择器5.class5</h4><p class="special">使用于别的标记</p></body></html><html><head><title>ID选择器</title><style type="text/css"><!--#one{font-weight:bold;/* 粗体 */}#two{font-size:31px;/* 字体大小 */color:#999900;/* 颜色 */}--></style></head><body><p id="one">ID选择器使用1</p><p id="two">ID选择器使用2</p><p id="two">ID选择器使用3</p></body></html> |
|