前言
目錄結構
舉例:星APP活動需求,根目錄文件夾“保留年后兩位開始的日期時間”-“活動內容”
Paste_Image.png
HTML模版
<!DOCTYPE HTML>
<html>
<head>
<meta charset="utf-8">
<meta name="format-detection" content="telephone=no" />
<meta name="viewport" content="width=device-width, initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0, user-scalable=no"/>
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
<meta name="apple-mobile-web-app-capable" content="yes" />
<meta name="apple-mobile-web-app-status-bar-style" content="black" />
<meta name="x5-fullscreen" content="true"/>
<title>騰訊應用寶星APP盛典</title>
<link href="../css/global.bak.css" rel="stylesheet">
</head>
<body>
<div class="wrapper">
<section class="header"></section>
<section class="content"></section>
<section class="footer"></section>
</div>
</body>
</html>
新標簽頁面結構圖如下:
Paste_Image.png
CSS reset
/*CSS Reset*/
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,header,hgroup,nav,section,article,aside,footer,figure,figcaption,menu {
margin: 0;
padding: 0;
}
h1,h2,h3,h4,h5,h6 {
font-size:26px;
font-weight: normal;
}
html{
height:100%;
}
table {
border-collapse: collapse;
border-spacing: 0;
}
fieldset,img {
display: block;
border: 0;
}
li {
list-style: none;
}
input,textarea,select {
font-family: inherit;
font-size: inherit;
font-weight: inherit;
}
a,input {
text-decoration: none;
color: #00a3ef;
-webkit-tap-highlight-color: none;
-webkit-tap-highlight-color: rgba(0, 0, 0, 0);
}
header,nav,section,article,footer,figure,figcaption {
display: block;
}
body {
font-family: Helvetica, "Microsoft YaHei";
line-height: 24px;
font-size: 14px;
color: #343434;
-webkit-user-select: none;
-webkit-text-size-adjust: none;
}
CSS命名規則
樣式類名全部用小寫,首字符必須是字母,禁止數字或其他特殊字符。由以字母開頭的小寫字母(a-z)、數字(0-9)、中劃線 (-)組成。
可以是單個單詞,也可以是組合單詞,要求能夠描述清楚模塊和元素的含義,使其具有語義化。避免使用 123456…,red,blue,left,right之類的(如顏色、字號大小等)矢量命名,如class="left-news"、class="2" ,以避免當狀態改變時名稱失去意義。盡量用單個單詞簡單描述class名稱。
雙單詞或多單詞組合方式:形容詞-名詞、命名空間-名次、命名空間-形容詞-名詞。例如:news-list、mod-feeds、mod-my-feeds、cell-title
命名規范
Paste_Image.png
Paste_Image.png
性能優化
- 圖標拼合雪碧圖;
- 盡量壓縮圖片體積,單張最好100kb以下,并選擇合適的圖片格式;
- 慎用DataURI,DataURI在移動端要比簡單的外鏈資源要慢6倍;
- 使用原生JS,讓代碼更快,避免使用各類庫增加文件體積;