CSS3通配符

时间:2023-03-08 19:32:22

在 CSS3 中,追加了三个属性选择器分别为:

[att*=val] ----内容包含

[att^=val] ----开头匹配

[att$=val] ----结尾匹配

示例:

<!DOCTYPE html>
<html>
<head lang="en">
<meta charset="UTF-8">
<title></title>
<style>
[id*=box]{
background: #75d8ff;
} [id^=box]{
background: #ff0000;
} [id$=blue]{
background: blue;
}
</style>
</head>
<body>
实例1:
<div id="box1">sdf</div>
<div id="2box">sdf</div>
<div id="box3blue">sdf</div>
</body>
</html>

CSS3通配符