본문 바로가기
개인 공부/프론트

[React] 기본 브라우저 모든 css 제거하기

by 육츠 2024. 10. 12.
Contents 접기

브라우저 마다 다양한 css 가 지정되어 내가 지정한 것과 엉킬 수도 있기 때문에 미리 제거 해야 한다.

 

https://meyerweb.com/eric/tools/css/reset/ 

 

CSS Tools: Reset CSS

CSS Tools: Reset CSS The goal of a reset stylesheet is to reduce browser inconsistencies in things like default line heights, margins and font sizes of headings, and so on. The general reasoning behind this was discussed in a May 2007 post, if you're inter

meyerweb.com

 

사이트 내 적힌 코드

/* 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 로 설정하고 바깥에 파일을 위치시켜 Main.js 로 import 시켰는데, 이게 맞는지는 모르겠다.

어쨌든 브라우저 요소가 사라지긴 했다.

 

Test 코드

<div>
    <ul>
        <li>reset.css</li>
        <li>브라우저 테스트</li>
    </ul>
</div>

왼) reset.css import 전 / 오) reset.css import 후