본문 바로가기
IT/CSS

CSS 초기화 코드

by Blog37 2024. 4. 29.
반응형

CSS 초기화(Reset) 코드 란?

크롬, 사파리, 파이어폭스 등등.. 각각의 웹 브라우저들 마다 기본적으로 세팅 되어져 있는 CSS 값들이 있다. 이러한 기본 세팅되어 있는 CSS 값들을 웹 퍼블리싱 개발 작업에 맞게 CSS를 초기화 시켜주는 코드이다.


[Eric Meyer's Reset CSS]

(기존 Eric Meyer's Reset CSS 코드에서 좀 더 응용시킨 코드 입니다.)

@charset "utf-8"; 

/* 폰트 적용 [Regular, Medium, Bold] */
/* @font-face {
    font-family: 'Noto Sans KR';
    font-style: normal;
    font-weight: 400;
    src: url('../font/NotoSansCJKkr-Regular.woff') format('woff'),
    url('../font/NotoSansCJKkr-Regular.otf') format('opentype'),
    url('../font/NotoSansCJKkr-Regular.ttf') format('truetype');
}
@font-face {
    font-family: 'Noto Sans KR';
    font-style: normal;
    font-weight: 500;
    src: url('../font/NotoSansCJKkr-Medium.woff') format('woff'),
    url('../font/NotoSansCJKkr-Medium.otf') format('opentype'),
    url('../font/NotoSansCJKkr-Medium.ttf') format('truetype');
}
@font-face {
    font-family:'Noto Sans KR';
    font-style: normal;
    font-weight: 700;
    src: url('../font/NotoSansCJKkr-Bold.woff') format('woff'),
    url('../font/NotoSansCJKkr-Bold.otf') format('opentype'),
    url('../font/NotoSansCJKkr-Bold.ttf') format('truetype');
} */

/* CSS 초기화 */
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:inherit; vertical-align:baseline;}
article, aside, details, figcaption, figure, 
footer, header, hgroup, menu, nav, section {display:block;}

*{margin:0; padding:0; box-sizing:border-box;}
html, body{ min-height:100%; }
html{overflow-x:hidden; overflow-y:scroll;}
body{/*font-family:'Noto Sans KR', sans-serif; font-size:16px; font-weight:400;*/
line-height:1.2; letter-spacing:0; word-wrap:break-word; word-break:keep-all;}

blockquote, q {quotes:none;}
blockquote:before, blockquote:after,
q:before, q:after {content:''; content:none;}
table {border-collapse: collapse; border-spacing:0;}
ul, ol{list-style:none;}
img{border:none; outline:none; vertical-align:top; -ms-user-select:none; user-select:none;}
a{text-decoration:none; outline:none;}
form{display:block;}
button, input, label, span, select{display:inline-block; vertical-align:baseline;}
button{border:none; background:none; cursor:pointer;}
textarea{outline:none; resize:none;}
select::-ms-expand{display:none;}

/* 모바일 */
@media screen and (max-width: 576px) { html {-webkit-text-size-adjust:100%; -moz-text-size-adjust:100%; -ms-text-size-adjust:100%;} }

/* input placeholder 설정 */
/* input::-webkit-input-placeholder {color: #aaaaaa;}
input:-ms-input-placeholder {color: #aaaaaa;}
textarea::-webkit-input-placeholder {color: #aaaaaa;}
textarea:-ms-input-placeholder{color: #aaaaaa;} */
반응형