【css】css规范

 说法一:

属性的书写顺序, 举个例子:

.hotel-content {
     /* 定位 */
     display: block;
     position: absolute;
     left: 0;
     top: 0;
     /* 盒模型 */
      50px;
     height: 50px;
     margin: 10px;
     border: 1px solid black;
     / *其他* /
     color: #efefef;
 }

定位相关, 常见的有:display position left top float 等
盒模型相关, 常见的有:width height margin padding border 等
其他属性
按照这样的顺序书写可见提升浏览器渲染dom的性能

说法二:

CSS书写顺序  
  1.位置属性(position, top, right, z-index,display, float等)  
  2.大小(width, height, padding, margin)  
  3.文字系列(font, line-height, letter-spacing,color- text-align等)  
  4.背景(background, border等)  
  5.其他(animation, transition等)

CSS命名规范(规则)常用的CSS命名规则

  头:header

  内容:content/container

  尾:footer

  导航:nav

  侧栏:sidebar

  栏目:column

  页面外围控制整体佈局宽度:wrapper

  左右中:left right center

  登录条:loginbar

  标志:logo

  广告:banner

  页面主体:main

  热点:hot

  新闻:news

  下载:download

  子导航:subnav

  菜单:menu

  子菜单:submenu

  搜索:search

  友情链接:friendlink

  页脚:footer

  版权:copyright

  滚动:scroll

  内容:content

  标签:tags

  文章列表:list

  提示信息:msg

  小技巧:tips

  栏目标题:title

  加入:joinus

  指南:guide

  服务:service

  注册:regsiter

  状态:status

  投票:vote

  合作伙伴:partner




相关资料:

  • https://jingyan.baidu.com/article/4d58d541dae69a9dd4e9c09b.html
  • https://www.zhihu.com/question/19586885
  • https://www.cnblogs.com/liyunhua/p/4537058.html#top
原文地址:https://www.cnblogs.com/websmile/p/9089015.html