1、伪类选择符 Pseudo-Classes Selectors
Selectors选择符CSS Version版本Description简介E:linkCSS1设置超链接a在未被访问前的样式。E:visitedCSS1设置超链接a在其链接地址已被访问过时的样式。E:hoverCSS1/2设置元素在其鼠标悬停时的样式。E:activeCSS1/2设置元素在被用户激活(在鼠标点击与释放之间发生的事件)时的样式。E:focusCSS1/2设置元素在成为输入焦点(该元素的onfocus事件发生)时的样式。E:lang(fr)CSS2匹配使用特殊语言的E元素。E:not(s)CSS3匹配不含有s选择符的元素E。E:rootCSS3匹配E元素在文档的根元素。E:first-childCSS2匹配父元素的第一个子元素E。E:last-childCSS3匹配父元素的最后一个子元素E。E:only-childCSS3匹配父元素仅有的一个子元素E。E:nth-child(n)CSS3匹配父元素的第n个子元素E。E:nth-last-child(n)CSS3匹配父元素的倒数第n个子元素E。E:first-of-typeCSS3匹配同类型中的第一个同级兄弟元素E。E:last-of-typeCSS3匹配同类型中的最后一个同级兄弟元素E。E:only-of-typeCSS3匹配同类型中的唯一的一个同级兄弟元素E。E:nth-of-type(n)CSS3匹配同类型中的第n个同级兄弟元素E。E:nth-last-of-type(n)CSS3匹配同类型中的倒数第n个同级兄弟元素E。E:emptyCSS3匹配没有任何子元素(包括text节点)的元素E。E:checkedCSS3匹配用户界面上处于选中状态的元素E。(用于input type为radio与checkbox时)E:enabledCSS3匹配用户界面上处于可用状态的元素E。E:disabledCSS3匹配用户界面上处于禁用状态的元素E。E:targetCSS3匹配相关URL指向的E元素。@page:firstCSS2设置页面容器第一页使用的样式。仅用于@page规则@page:leftCSS2设置页面容器位于装订线左边的所有页面使用的样式。仅用于@page规则@page:rightCSS2设置页面容器位于装订线右边的所有页面使用的样式。仅用于@page规则
2、resize
resize:none | both | horizontal | vertical
默认值:none
适用于:所有设置了overflow除了visible之外的元素
继承性:无
案例:
<style>.test{overflow:auto;width:200px;height:100px;resize:both;background:#eee;}</style>
<div class="test"> <ul> <li>新闻列表</li> <li>新闻列表</li> <li>新闻列表</li> </ul></div>
3、outline-offset
outline-offset:<length>
默认值:0
适用于:所有元素
继承性:无
案例:
<style>.test{width:220px;padding:10px;outline:1px dashed #333;outline-offset:4px;border:3px solid #333;}</style><div class="test">注意虚线轮廓偏移容器的距离<br />outline-offset:4px;</div>
4、transform(变换)
transform:none | matrix(<number>,<number>,<number>,<number>,<number>,<number>)? translate(<length>[,<length>])? translateX(<length>)? translateY(<length>)? rotate(<angle>)? scale(<number>[,<number>])? scaleX(<number>)? scaleY(<number>)? skew(<angle>[,<angle>])? skewX(<angle>) || skewY(<angle>)?
默认值:none
适用于:所有块级元素及某些内联元素
继承性:无
* transform-origin
transform-origin:[ <percentage> | <length> | left | center① | right ] [ <percentage> | <length> | top | center② | bottom ]?
默认值:50% 50%,效果等同于center center
适用于:所有块级元素及某些内联元素
继承性:无
5、transition
transition:[ transition-property ] || [ transition-duration ] || [ transition-timing-function ] || [ transition-delay ]
默认值:看每个独立属性
适用于:所有元素,包含伪对象:after和:before
继承性:无
缩写方式:
transition:border-color .5s ease-in .1s, background-color .5s ease-in .1s, color .5s ease-in .1s;拆分方式:
transition-property:border-color, background-color, color; transition-duration:.5s, .5s, .5s; transition-timing-function:ease-in, ease-in, ease-in; transition-delay:.1s, .1s, .1s; 如果定义了多个过渡的属性,而其他属性只有一个参数值,则表明所有需要过渡的属性都应用同一个参数值。据此可以对上面的例子进行缩写:拆分方式:
transition-property:border-color, background-color, color; transition-duration:.5s; transition-timing-function:ease-in; transition-delay:.1s; 如果需要定义多个过渡属性且不想指定具体是哪些属性过渡,同时其他属性只有一个参数值,据此可以对上面的例子进行缩写:缩写方式:
transition:all .5s ease-in .1s;拆分方式:
transition-property:all; transition-duration:.5s; transition-timing-function:ease-in; transition-delay:.1s; 对应的脚本特性为transition。
6、动画 Animation
Properties属性CSS Version版本Inherit From Parent继承性Description简介animationCSS3无复合属性。检索或设置对象所应用的动画特效animation-nameCSS3无检索或设置对象所应用的动画名称animation-durationCSS3无检索或设置对象动画的持续时间animation-timing-functionCSS3无检索或设置对象动画的过渡类型animation-delayCSS3无检索或设置对象动画延迟的时间animation-iteration-countCSS3无检索或设置对象动画的循环次数animation-directionCSS3无检索或设置对象动画在循环中是否反向运动animation-play-stateCSS3无检索或设置对象动画的状态animation-fill-modeCSS3无检索或设置对象动画时间之外的状态7、 user-select
user-select:none | text | all | element
默认值:text
适用于:除替换元素外的所有元素
继承性:无
案例:<style>.testSelect1{padding:10px;-webkit-user-select:none;-moz-user-select:none;-o-user-select:none;user-select:none;background:#eee;}.testSelect2{padding:10px;-webkit-user-select:none;-moz-user-select:text;-o-user-select:none;user-select:none;background:#eee;}.testSelect3{padding:10px;-webkit-user-select:none;-moz-user-select:all;-o-user-select:none;user-select:none;background:#eee;}</style>
<div class="testSelect1">选择我试试,你会发现怎么也选择不到我,哇哈哈</div> <div class="testSelect2" onselectstart="return false;" unselectable="on">我是正常的</div> <div class="testSelect3" onselectstart="return false;" unselectable="on">选择我试试,你会发现我们是一个整体,哇哈哈</di
8、新的边框属性
属性描述CSSborder-image设置所有 border-image-* 属性的简写属性。3border-radius设置所有四个 border-*-radius 属性的简写属性。3box-shadow向方框添加一个或多个阴影。3
转载于:https://www.cnblogs.com/Better-Me/p/4242031.html
