CSS3有哪些新特性?

179 阅读1分钟

圆角:border-radius

 .box{
        width: 100px;
        height: 100px;
        /* border-radius: 50%;圆形 */
        border-radius: 20px;
        background-color: red;
    }

阴影:box-shadow

.box{
        width: 100px;
        height: 100px;
        box-shadow: 0 0 20px yellow;
        background-color: red;
    }

box-shadow: 水平方向偏移量 垂直方向偏移量 模糊半径 阴影颜色

文本阴影:text-shadow

 .box{
        width: 100px;
        height: 100px;
        text-shadow: 0 0 10px red;
        background-color: #222;
    }

用法同box-shadow一样。

过渡:transition

transition: CSS属性,花费时间,效果曲线(默认ease),延迟时间(默认0)

动画:animation

animation:动画名称,一个周期花费时间,运动曲线(默认ease),动画延迟(默认0),播放次数(默认1),是否反向播放动画(默认normal),是否暂停动画(默认running)
除此之外,还有

  • 线性渐变 (gradient)
  • 偏移(transform)