CSS规范属性书写顺序

本文详细介绍了CSS属性的书写顺序,包括布局定位、自身属性、文本属性及CSS3扩展属性,遵循前端编码最佳实践,如.positioning, .box-model, .typography等,并推荐了前端代码规范文档。
摘要由CSDN通过智能技术生成

标题css属性书写顺序

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

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

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

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

.sidebar {
    /* formatting model: positioning schemes / offsets / z-indexes / display / ...  */
    position: absolute;
    top: 50px;
    left: 0;
    overflow-x: hidden;

    /* box model: sizes / margins / paddings / borders / ...  */
    width: 200px;
    padding: 5px;
    border: 1px solid #ddd;

    /* typographic: font / aligns / text styles / ... */
    font-size: 14px;
    line-height: 20px;

    /* visual: colors / shadows / gradients / ... */
    background: #f5f5f5;
    color: #333;
    -webkit-transition: color 1s;
       -moz-transition: color 1s;
            transition: color 1s;
}

参考

CSS属性书写顺序|css编码规范
最近看到的另一个非常不错的前端编码规范文档,必须强烈推荐:
前端代码规范@mdo

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值