html과 css를 이용하여 웹페이지를 만들어 보면 기본적으로 폰트, 폰트의 크기, margin 등이 설정되어 있다. 이를 초기화하기 위해 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;
}
출처: https://cssdeck.com/blog/scripts/eric-meyer-reset-css/
위 코드를 작성한 reset.css 파일을 별도로 만들고, 기존 css 파일에서 그 파일을 import하면 된다.
@import "reset.css"
주의: 파일의 정확한 위치를 명시해야 한다. 만약 reset.css 파일을 import할 css 파일이 위치한 곳에 temp라는 폴더가 있고, 그 폴더 안에 reset.css 파일이 있다면 아래와 같이 써야 한다.
@import "temp/reset.css"
'html & css & js 공부' 카테고리의 다른 글
HTML 이용해서 API 만들기 (0) | 2023.10.09 |
---|---|
css: css에서 레이어처럼 겹치는 순서 조정하기 (0) | 2023.01.14 |
css relative position: 겹쳐서 표현하기 (0) | 2023.01.07 |
css에서 특정 tag 혹은 attribute 선택하기 (0) | 2023.01.06 |
html에서 icon 추가하는 방법 & BEM (0) | 2023.01.05 |
댓글