[CSS] reset CSS

Isabel·2022년 6월 5일
0

웹브라우저에 따라 디폴트 스타일이 상이하고 지원하는 tag나 style도 제각각이기 때문에 개발자의 의도와 다르게 나타날 수 있다. 그렇기 때문에 사전에 CSS를 초기화 해주는 작업을 해줄 수 있는데, 이를 reset CSS라고 한다.

아래 예시는 Eric Meyer’s reset 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;
}

reset CSS를 해주고 나면 브라우저에서 다른 설정값 없이 내가 원하는 방향으로 CSS를 조정하기가 용이해질 것이다.

0개의 댓글