一個很小的現代CSS重置,涵蓋了基本內容:
- 重置字體大小:這樣使用語義標記不會影響樣式
- 重置塊邊距:所以只有在需要時才應用間距
- 重置表格:這樣表格數據只占用它所需的空間
- 保留了行內間距:因此,按鈕和輸入保持其默認布局
- 設置邊框的大小:這樣邊框和划線不會影響設置的尺寸
- 設置響應的媒體元素:以便圖像和嵌入與瀏覽器的寬度成比例。
開源地址:https://github.com/jgthms/minireset.css
應用網站:騰訊網
/*! minireset.css v0.0.3 | MIT License | github.com/jgthms/minireset.css */ html, body, p, ol, ul, li, dl, dt, dd, blockquote, figure, fieldset, legend, textarea, pre, iframe, hr, h1, h2, h3, h4, h5, h6 { margin: 0; padding: 0; } h1, h2, h3, h4, h5, h6 { font-size: 100%; font-weight: normal; } ul { list-style: none; } button, input, select, textarea { margin: 0; } html { box-sizing: border-box; } *, *:before, *:after { box-sizing: inherit; } img, embed, iframe, object, audio, video { height: auto; max-width: 100%; } iframe { border: 0; } table { border-collapse: collapse; border-spacing: 0; } td, th { padding: 0; text-align: left; }