html5中的选择器

1、html5中的属性选择器

<body>

<style type=text/css>

<!--1>完全匹配选择器-->

[id=test]{

  color:red;

  //比较严格只是匹配元素中的id是test的选择器

}

<!--2>包含匹配属性选择器-->

[id*=test]{

  color:green;

//相比较完全匹配的属性选择器这个的范围要广泛,只要是选择器的值中要test就可以被改变

}

<!--3>首部字符匹配属性选择器-->

[id^=test]{

  color:blue;

//只要是选择其中的头部是test的话,就会受到影响

}

<!--尾部字符属性选择器-->

[id$=test]{

  color:yellow;

}

//只要是属性选择器的尾部是test就会受到影响

</style>

<div id="test">Hello</div>

<div id="mytest">World</div>

<div id="tests>Thinks</div>

</body>

原文地址:https://www.cnblogs.com/limit1/p/4094781.html