innn

Reset CSS과 css분리(divide & conquer) 본문

FE/HTML CSS 자바 스크립트

Reset CSS과 css분리(divide & conquer)

33삼 2022. 8. 27. 15:13

리셋 CSS 를 복사 붙여넣기해서 웹 브라우저에 디폴트로 깔린 모든 CSS를 없애준다.

https://cssdeck.com/blog/scripts/eric-meyer-reset-css/

 

Eric Meyer’s “Reset CSS” 2.0 | CSS Reset

One of the pioneers of the method, Eric Meyer's CSS Reset is still in use on millions of websites today. Find it and others, with full guides and docs, on CSSReset.com

cssdeck.com

 

리셋할 코드는 아래와 같다.

이를 복사 붙여넣기해서 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;
}

 

 

html 파일에 링크로 넣지 않고, css를 이용해 추가하는 것이 좋다 

 

임포트문 뒤에 넣어주면 된다.

html 파일에 링크를 여러개 하는 것보다 css에 추가해주는 것이 더 좋은 방법이다.

 

 

status-bar에 적용한 css들도 하나의 css파일로 빼서 import 문으로 넣어준다.

styles.css 파일은 다른 css 파일을 추가하는 파일로 쓰는 것이다.

 

이를, css 파일을 여러개로 분할했다가 합치는 것이다 (divide & conquer)

 

그중 status-bar를 분리시킨 이유는, 모든 페이지는 status-bar를 가지고 있기 때문이다.

 

 

'FE > HTML CSS 자바 스크립트' 카테고리의 다른 글

헤더 css 넣어주기  (0) 2022.08.27
display: flex와 text-align:center 차이점  (0) 2022.08.27
구글 폰트와 css hack(justify-content 대신 사용)  (0) 2022.08.27
헤더 넣기  (0) 2022.08.27
아이콘 넣기  (0) 2022.08.27