本文主要包含css3选择器,css3伪类选择器,css3类选择器,css3属性选择器,css3选择器有哪些等相关知识,trigkit4   希望在学习及工作中可以帮助到您
  1. 根选择器 :root
:root{}就等同于html{}, 一般来说, 推荐使用:root{}.
- <style>
 - :root {
 - background:green;
 - }
 - </style>
 - <div>:root选择器的演示</div>
 
2. 否定选择器 :not
否定选择器, 就是除此之外的
- <style>
 - input:not([type="submit"]) {
 - border: 1px solid red;
 - }
 - </style>
 - <form action="#">
 - <div>
 - <label for="name">账号:</label>
 - <input type="text" name="name" id="name" placeholder="请填写账号" />
 - </div>
 - <div>
 - <label for="password">密码:</label>
 - <input type="password" name="password" id="password" placeholder="请填写密码" />
 - </div>
 - <div>
 - <input type="submit" value="Submit" />
 - </div>
 - </form>
 
3. 空选择器 :empty
注意: :empty 只对一点内容都没有的元素生效, 哪怕有一个空格都不行.
- <style>
 - div:empty {
 - border: 1px solid green;
 - }
 - </style>
 - <div>我这里有内容</div>
 - <div> <!-- 我这里有一个空格 --></div>
 - <div></div><!-- 我这里任何内容都没有 -->
 
4.目标选择器 :target
超链接地址, 与id对应
- <style>
 - .not_show{
 - display: none;
 - }
 - #test:target{
 - display:block;
 - }
 - </style>
 - <h2><a href="#test">test</a></h2>
 - <div class="not_show" id="test">
 - 这是一个测试
 - </div>
 - <style>
 - #pipi:target {
 - background: orange;
 - color: #fff;
 - }
 - #ruby:target {
 - background: blue;
 -  
 

