font属性
div {font: font-style font-weight font-size font-family;}
p {font: italic 600 12px Arial;}
注意
使用font属性时,必须按上面语法格式中的顺序书写,不能更换顺序,各个属性以空格隔 开。
其中不需要设置的属性可以省略(取默认值),但必须保留font-size和font-family属性,否 则font属性将不起作用。
background属性
div {background: 背景颜色 背景图片地址 背景平铺 背景滚动 背景位置}
div {background: transparent url(./image/1.jpg) no-repeat fixed center center }
/*背景透明、背景图片为1.jpg、不平铺、背景不随对象滚动、垂直水平居中*/
注意
background:属性的值的书写顺序官方并没有强制标准的。为了可读性,建议大家如下写:
background: 背景颜色 背景图片地址 背景平铺 背景滚动 背景位置;
transform属性(2d转换)
div {transform: translate() rotate() scale()}
div:hover {transform: translate(200px,0) rotate(180deg) scale(1.2)}
animation属性
.move {animation: 动画名称 持续时间 运动曲线 何时开始 播放次数 是否反方向 起始与结束状态 }
.move {animation: move 1s linear 0s infinite alternate forwards}