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

css学习之属性选择器

2016-12-05 22:20 323 查看
1、属性选择器

对带有指定属性的HTML元素设置样式

<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Title</title>
<style type="text/css">
[title]{
color: blue;
}
</style>
</head>
<body>
<p title="t">属性选择器</p>
</body>
</html>


2、属性和值选择器

<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Title</title>
<style type="text/css">
[title]{
color: blue;
}
[title=te]{
color: red;
}
</style>
</head>
<body>
<p title="t">属性选择器</p>
<p title="te">属性和值选择器</p>
</body>
</html>
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: