CSS 最佳实践 + 套路(一) -- 概述
资源
- Google: 关键词 MDN
- CSS Tricks
- Google: 阮一峰 css
- 张鑫旭的 240 多篇 CSS 博客
- Codrops 炫酷 CSS 效果
- CSS揭秘
- CSS 2.1 中文 spec
- Magic of CSS 免费在线书引入CSS
- 内联样式 ==> style属性 ==> style= 'color: red; width: 200px; height:200px;'
- 内嵌样式 ==> - style标签 ==>- 1 
 2
 3
 4
 5
 6- <style> 
 body{
 background: gray;
 font-size: 12px;
 }
 </style>
- 外联样式 ==> - <link>标签 ==>- 1 - <link rel= 'stylesheet' href= ''> 
- @import url(./b/css)
最佳实践 & 套路
reset CSS
1
2
*{ margin: 0; padding: 0; }
h1, h2, h3, h4, h5, h6, p{ margin: 0; padding: 0; }
清除浮动
添加到浮动元素的父元素上。1
2
3
4
5.clearfix::after{
    content: '';
    display: block;
    clear: both;
}
相关知识点
元素分类:
- 块级元素:block==>display: block;
- 内联元素:inline==>display: inline;
- 内联块级元素:inline-block==>display: inline-block;
