前端代码规范剪辑

CSS属性书写顺序,建议遵循一下顺序:

1. 布局定位属性: display/position/float/clear/visibility/overflow

2. 自身属性: width/height/margin/padding/border/background

3. 文本属性: color/font/text-decoration/text-align/vertical-align/white-space/break-word

4. 其他属性(CSS3): content/cursor/border-radius/box-shadow/text-shadow/background: linear-gradient...

.style {
    display: block;
    position: relative;
    float: left;
    width: 100px;
    height: 100px;
    margin: 0 10px;
    padding: 20px 0;
    font-family: Arial, 'Helvetica Neue', Helvetica, sans-serif;
    color: #333;
    background: rgba(0,0,0,.5);
    -webkit-border-radius: 10px;
    -moz-border-radius: 10px;
    -o-border-radius: 10px;
    -ms-border-radius: 10px;
    border-radius: 10px;
}

CSS3浏览器私有前缀写法

.style {
    -webkit-border-radius: 10px;
    -moz-border-radius: 10px;
    -o-border-radius: 10px;
    -ms-border-radius: 10px;
    border-radius: 10px;
}

 

上一篇:浏览器私有前缀


下一篇:CSS常用简写样式