# reset.css
###### tags: `CSS` `前端`
瀏覽器都會有預設樣式,當我自己的 style.css 沒有特別指定樣式的時候,會直接套用預設樣式

(此圖為 Edge 當中 h1 的預設樣式)
雖然預設樣式很方便,但缺點就是「**不可控**」,先不提不同瀏覽器設定可能就不同,要是哪天瀏覽器自行更改樣式導致設計跑版,就會有問題。
因此我們需要一份 reset.css
其實說穿了就是我們先把所有的標籤樣式自行「初始化」的概念,下面這個是網路上最熱門的 reset.css 範本
https://meyerweb.com/eric/tools/css/reset/
```css=
/* http://meyerweb.com/eric/tools/css/reset/
v2.0 | 20110126
License: none (public domain)
*/
html, body, div, span, applet, object, iframe,
h1, h2, h3, h4, h5, h6, p, blockquote, pre,
a, abbr, acronym, address, big, cite, code,
del, dfn, em, img, ins, kbd, q, s, samp,
small, strike, strong, sub, sup, tt, var,
b, u, i, center,
dl, dt, dd, ol, ul, li,
fieldset, form, label, legend,
table, caption, tbody, tfoot, thead, tr, th, td,
article, aside, canvas, details, embed,
figure, figcaption, footer, header, hgroup,
menu, nav, output, ruby, section, summary,
time, mark, audio, video {
margin: 0;
padding: 0;
border: 0;
font-size: 100%;
font: inherit;
vertical-align: baseline;
}
/* HTML5 display-role reset for older browsers */
article, aside, details, figcaption, figure,
footer, header, hgroup, menu, nav, section {
display: block;
}
body {
line-height: 1;
}
ol, ul {
list-style: none;
}
blockquote, q {
quotes: none;
}
blockquote:before, blockquote:after,
q:before, q:after {
content: '';
content: none;
}
table {
border-collapse: collapse;
border-spacing: 0;
}
```
### 排版用
```css=
/* 所有元素都套用 border-box 的效果,可加入 reset.css */
*,*:before,*:after {
box-sizing: border-box;
}