css的書寫規範

來源:互聯網
上載者:User

標籤:

格式化:

 

body,div,dl,dt,dd,ul,ol,li,h1,h2,h3,h4,h5,h6,pre,code,form,fieldset,legend,input,textarea,p,blockquote,th,td,hr,button,article,aside,details,figcaption,figure,footer,header,hgroup,menu,nav,section{
margin:0;
padding:0;
}
a{
color: inherit;
text-decoration: none;
display: inline-block;
}

 

font-family(字型族): “Arial”、“Times New Roman”、“宋體”、“黑體”等;
font-style(字型樣式): normal(正常)、italic(斜體)或oblique(傾斜);
font-variant (字型變化): normal(正常)或small-caps(小體大寫字母);
font-weight (字型濃淡): 是normal(正常)或bold(加粗)。有些瀏覽器甚至支援採用100到900之間的數字(以百為單位);
font-size(字型大小): 可通過多種不同單位(比如像素或百分比等)來設定, 如:12xp,12pt,120%,1em

font 屬性的值應按以下次序書寫(各個屬性之間用空格隔開):

順序:font-style | font-variant | font-weight | font-size | line-height | font-family

 

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等)
簡寫屬性,去掉小數點前的0,顏色代碼縮寫,不使用_ ,一律小寫;
詞暉
連結:http://www.zhihu.com/question/19586885/answer/48933504
來源:知乎
著作權歸作者所有,轉載請聯絡作者獲得授權。

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

注釋的寫法:

  /* Header */

  內容區

  /* End Header */

Id的命名:

  1)頁面結構

  容器: container

  頁頭:header

  內容:content/container

  頁面主體:main

  頁尾:footer

  導航:nav

  側欄:sidebar

  欄目:column

  頁面外圍控制整體佈局寬度:wrapper

  左右中:left right center

(2)導航

  導航:nav

  主導航:mainnav

  子導航:subnav

  頂導航:topnav

  邊導航:sidebar

  左導航:leftsidebar

  右導航:rightsidebar

  菜單:menu

  子功能表:submenu

  標題: title

  摘要: summary

(3)功能

  標誌:logo

  廣告:banner

  登陸:login

  登入條:loginbar

  註冊:register

  搜尋:search

  功能區:shop

  標題:title

  加入:joinus

  狀態:status

  按鈕:btn

  滾動:scroll

  標籤頁:tab

  文章列表:list

  提示資訊:msg

  當前的: current

  小技巧:tips

  表徵圖: icon

  注釋:note

  指南:guild

  服務:service

  熱點:hot

  新聞:news

  下載:download

  投票:vote

  夥伴:partner

  友情連結:link

  著作權:copyright

注意事項::

  1.一律小寫;

  2.盡量用英文;

  3.不加中槓和底線;

  4.盡量不縮寫,除非一看就明白的單詞。

CSS樣式表檔案命名

  主要的 master.css

  模組 module.css

  基本共用 base.css

  布局、版面 layout.css

  主題 themes.css

  專欄 columns.css

  文字 font.css

  表單 forms.css

  補丁 mend.css

  列印 print.css

css的書寫規範

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.