您的位置:首页 > Web前端 > HTML

选择器.HTML

2015-10-03 17:52 513 查看
<!doctype html>
<html>
<head>
<meta charset="gb2312">
<title>选择器</title>
<style>
#fist{color:#00F;font_weight:bold}//id选择器用#
.second{color:#FF0;font-size:20px}//类选择器用.
</style>
</head>

<body>
<p>这是标签选择器</p>
<p id="fist">这是ID选择器</p>
<p class="second">这是类选择器</p>
</body>
</html>


<!doctype html>
<html>
<head>
<meta charset="gb2312">
<title>属性选择器</title>
<style type="text/css">
[align="center"]{color:#0F0}
[name~="t1"]{color:#000}//用空格隔开的属性名称变为#000(#表示的是16进制的数)
[name|="t"]{color:#0FF}//用-连接的属性名称变为#0FF颜色
</style>
</head>

<body>
<p align="center">属性选择器1</p>
<p align="center" name="t t1">属性选择器2</p>
<p align="center" name="t-t1">属性选择器3</p>

</body>
</html>
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签:  选择器 HTML