网络编程
位置:首页>> 网络编程>> 网页设计>> CSS3变换入门(4)

CSS3变换入门(4)

作者:神飞 来源:前端观察 发布时间:2010-01-30 13:29:00 

标签:css3,变换,入门,dhtml

添加多重变换

因为一个变换就是一个CSS属性,如果你在同一个CSS规则中添加多个变换的实例,那么最后的那个将会覆盖前面的,而不是添加它们。所以在下面的规则中,唯一的变换将是背景色彩:

a:hover {
  color: red;
  background-color: rgb(235,235,185);
  -webkit-transition: color .25s linear;
  transition: color .25s linear;
  transition: background-color .15s linear .1;
}

当然,这并不是说,不能添加多重变换——多重变换可以在同一个变换属性定义中用逗号隔开:

a:hover {
  color: red;
  background-color: rgb(235,235,185);
   -webkit-transition: color .25s linear, background-color .15s linear .1s;
  transition: color .25s linear, background-color .15s linear .1s;
 }

这条定义将产生色彩和背景色的双重变换。

什么可以被变换?

几乎所有的有色彩、大小或位置等组件的CSS属性,包括许多新添加的CSS 3属性, 都可以应用变换。一个值得注意的例外是box-shadow。

来自W3C的变换的说明,这里是一个可以赋予变换的CSS属性的列表,附带转变的对象,我也高亮了一些比较有用的属性。

CSS属性改变的对象
background-color色彩
background-image只是渐变
background-position百分比,长度
border-bottom-color色彩
border-bottom-width长度
border-color色彩
border-left-color色彩
border-left-width长度
border-right-color色彩
border-right-width长度
border-spacing长度
border-top-color色彩
border-top-width长度
border-width长度
bottom百分比,长度
color色彩
crop百分比
font-size百分比,长度
font-weight数字
grid-*数量
height百分比,长度
left百分比,长度
letter-spacing长度
line-height百分比,长度,数字
margin-bottom长度
margin-left长度
margin-right长度
margin-top长度
max-height百分比,长度
max-width百分比,长度
min-height百分比,长度
min-width百分比,长度
opacity数字
outline-color色彩
outline-offset整数
outline-width长度
padding-bottom长度
padding-left长度
padding-right长度
padding-top长度
right百分比,长度
text-indent百分比,长度
text-shadow阴影
top百分比,长度
vertical-align百分比,长度,关键词
visibility可见性
width百分比,长度
word-spacing百分比,长度
z-index正整数
zoom数字

 

0
投稿

猜你喜欢

手机版 网络编程 asp之家 www.aspxhome.com