댓글 목록

CSS Reset and Unset

페이지 정보

작성자 운영자 작성일 19-02-05 21:22 조회 1,225 댓글 0

동영상 강좌는 유튜브 채널 '웹학교'를 이용하시기 바랍니다.

CSS Reset


CSS Reset은 스타일 요소에 대한 깨끗한 슬레이트를 사용하여 여러 브라우저에서 스타일 일관성을 강화하는 데 도움이 됩니다. 

Normalize 등의 CSS 재설정 라이브러리를 사용하거나 좀 더 단순화 된 재설정 방법을 사용할 수 있습니다.

*,
*::before,
*::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

이제 요소는 여백과 패딩을 제거하고 상자 크기는 CSS 상자 모델로 레이아웃을 관리 할 수 있게 해줍니다.


그누보드5/영카트5에서 사용하고 있는 CSS 초기화(5.3.2.4기준)


html {overflow-y:scroll}
body {margin:0;padding:0;font-size:0.75em;font-family:'Malgun Gothic', dotum, sans-serif;background:#e7e7e7}
html, h1, h2, h3, h4, h5, h6, form, fieldset, img {margin:0;padding:0;border:0}
h1, h2, h3, h4, h5, h6 {font-size:1em;font-family:'Malgun Gothic', dotum, sans-serif}
article, aside, details, figcaption, figure, footer, header, hgroup, menu, nav, section {display:block}

ul, dl,dt,dd {margin:0;padding:0;list-style:none}
legend {position:absolute;margin:0;padding:0;font-size:0;line-height:0;text-indent:-9999em;overflow:hidden}
label, input, button, select, img {vertical-align:middle;font-size:1em}
input, button {margin:0;padding:0;font-family:'Malgun Gothic', dotum, sans-serif;font-size:1em}
input[type="submit"]{cursor:pointer}
button {cursor:pointer}

textarea, select {font-family:'Malgun Gothic', dotum, sans-serif;font-size:1em}
select {margin:0}
p {margin:0;padding:0;word-break:break-all}
hr {display:none}
pre {overflow-x:scroll;font-size:1.1em}
a {color:#000;text-decoration:none}

*, :after, :before {
    -webkit-box-sizing: border-box;
    -moz-box-sizing: border-box;
    box-sizing: border-box;
}

input[type=text],input[type=password], textarea {
-webkit-transition: all 0.30s ease-in-out;
-moz-transition: all 0.30s ease-in-out;
-ms-transition: all 0.30s ease-in-out;
-o-transition: all 0.30s ease-in-out;
outline: none;
}
 
input[type=text]:focus,input[type=password]:focus,  textarea:focus,select:focus {
-webkit-box-shadow:  0 0 5px #9ed4ff;
-moz-box-shadow:  0 0 5px #9ed4ff;
box-shadow: 0 0 5px #9ed4ff;
border: 1px solid #558ab7 !important;
}
.placeholdersjs { color: #aaa !important; }


모든 속성을 재설정하는 대신 unset 사용 

요소의 속성을 재설정 할 때 각 속성을 다시 설정할 필요는 없습니다.


button {

  background: none;

  border: none;

  color: inherit;

  font: inherit;

  outline: none;

  padding: 0;

}


all 단축형을 사용하여 요소의 모든 속성을 지정할 수 있습니다. 

값을 설정 해제로 설정하면 요소의 속성이 초기 값으로 변경됩니다.

button {

  all: unset;

}


** all 단축형은 IE11에서 지원되지 않으며 현재 Edge의 지원을 고려 중입니다. unset은 IE11에서 지원되지 않습니다.



관련 사이트 



댓글목록 0

등록된 댓글이 없습니다.