<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>css属性选择器</title>
<style type="text/css">
/* 属性选择器 通常在表单控件中使用比较频繁*/
label[for] {
color: red;
}
label[for='pwd'] {
color: yellow;
}
/*匹配以什么开头*/
label[for^='vip'] {
font-size: 30px;
}
/*匹配以什么结尾*/
label[for$='r'] {
color: darkorange;
}
/*匹配包含什么的*/
label[for*='w'] {
font-size: 50px;
}
</style>
</head>
<body>
<form action="">
<label for="user">用户名</label>
<input type="text" id="user">
<label for="pwd">密码</label>
<label for="vip1">VIP1</label>
<label for="vip2">VIP2</label>
</form>
</body>
</html>