CSS选择器

 

 

CSS3选择器

【UI元素状态伪类选择器】

/*在CSS3中,共有17种UI元素状态伪类选择器,分别是E:hover、
    E:active、E:focus、E:disabled、E:read-only、E:checked、
    E:default、E:indeterminate、E::selection、E:invalid、
    E:valid、E:required、E:optional、E:in-range.*/

input[type="text"]:hover{} /*鼠标悬停的样式*/
input[type="text"]:focus{} /*获取焦点的样式*/
input[type="checkbox"]:checked{} /*勾选之后的样式*/

input[type="text"]:enabled{} /*元素可用时的样式*/
input[type="text"]:disabled{} /*元素不可用时的样式*/
View Code

 

【通用兄弟元素选择器】

/*通用兄弟元素选择器,用来指定位于同一个父元素之中的某个元素之后的所有其他某个种类的兄弟元素所使用样式。*/
div ~ p{}/*div与p是同一个父元素下的,且 作为div的相邻的p兄弟元素设置样式。*/
   
View Code

 

posted @ 2015-11-01 21:38  LetitiaChan  阅读(113)  评论(0编辑  收藏  举报