차이
문서의 선택한 두 판 사이의 차이를 보여줍니다.
다음 판 | 이전 판 | ||
tech:css_selector [2014/11/20 17:25] – 만듦 V_L | tech:css_selector [2018/12/31 16:20] (현재) – 59.10.111.63 | ||
---|---|---|---|
줄 1: | 줄 1: | ||
+ | {{tag> css html div center }} | ||
======CSS 선택자(Selector)====== | ======CSS 선택자(Selector)====== | ||
줄 5: | 줄 6: | ||
선택자는 Type(element), | 선택자는 Type(element), | ||
- | ^패턴|뜻^ | + | ^패턴^뜻^ |
|#id|id로 지정된 요소 선택| | |#id|id로 지정된 요소 선택| | ||
|.class|class로 지정된 요소 선택| | |.class|class로 지정된 요소 선택| | ||
줄 52: | 줄 53: | ||
====복합 선택자(Combinator)==== | ====복합 선택자(Combinator)==== | ||
+ | |||
+ | <file css> | ||
+ | .mMenu a: | ||
+ | .mMenu a: | ||
+ | .mMenu a: | ||
+ | .mMenu a: | ||
+ | .mMenu a: | ||
+ | .mMenu a: | ||
+ | .mMenu a: | ||
+ | .mMenu a: | ||
+ | .mMenu a: | ||
+ | |||
+ | |||
+ | </ | ||
===하위 선택자(Descendant Combinator)와 자식 선택자(Child Combinator)=== | ===하위 선택자(Descendant Combinator)와 자식 선택자(Child Combinator)=== | ||
줄 60: | 줄 75: | ||
태그들이 포함 관계를 가질 때 포함하는 요소를 부모 요소, 포함되는 요소를 자식 요소라고 합니다. 하위 선택자는 부모 요소에 포함된 ‘모든’ 하위 요소에 스타일을 적용합니다. 하지만, 자식 선택자는 부모의 바로 아래 자식 요소에만 적용합니다 | 태그들이 포함 관계를 가질 때 포함하는 요소를 부모 요소, 포함되는 요소를 자식 요소라고 합니다. 하위 선택자는 부모 요소에 포함된 ‘모든’ 하위 요소에 스타일을 적용합니다. 하지만, 자식 선택자는 부모의 바로 아래 자식 요소에만 적용합니다 | ||
- | {{http:// | ||
===인접 형제 선택자(Adjacent Sibling Combinator)와 일반 형제 선택자(General Sibling Combinator)=== | ===인접 형제 선택자(Adjacent Sibling Combinator)와 일반 형제 선택자(General Sibling Combinator)=== | ||
줄 99: | 줄 113: | ||
<a href=" | <a href=" | ||
</ | </ | ||
- | =====CSS 초기화 (Clearing; Reset)===== | ||
- | 여러 소스를 짜집기 할 때 서로 영향을 주는 경우 사용한다. | ||
- | <code 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, font, 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 { | ||
- | margin: 0; | ||
- | padding: 0; | ||
- | border: 0; | ||
- | outline: 0; | ||
- | vertical-align: | ||
- | background: transparent; | ||
- | }</ | ||
- | |||
- | 아니면 다음과 같은 파일을 사용할 수도 있다. | ||
- | |||
- | <file css reset.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, font, img, ins, kbd, q, s, samp, | ||
- | small, strike, strong, sub, sup, tt, var, | ||
- | dl, dt, dd, ol, ul, li, | ||
- | fieldset, form, label, legend, | ||
- | table, caption, tbody, tfoot, thead, tr, th, td { | ||
- | margin: 0; | ||
- | padding: 0; | ||
- | border: 0; | ||
- | outline: 0; | ||
- | font-weight: | ||
- | font-style: inherit; | ||
- | font-size: 100%; | ||
- | font-family: | ||
- | vertical-align: | ||
- | } | ||
- | /* remember to define focus styles! */ | ||
- | :focus { | ||
- | outline: 0; | ||
- | } | ||
- | body { | ||
- | line-height: | ||
- | color: black; | ||
- | background: white; | ||
- | } | ||
- | ol, ul { | ||
- | list-style: none; | ||
- | } | ||
- | /* tables still need ' | ||
- | table { | ||
- | border-collapse: | ||
- | border-spacing: | ||
- | } | ||
- | caption, th, td { | ||
- | text-align: left; | ||
- | font-weight: | ||
- | } | ||
- | blockquote: | ||
- | q:before, q:after { | ||
- | content: ""; | ||
- | } | ||
- | blockquote, q { | ||
- | quotes: "" | ||
- | }</ | ||
- | =====background===== | ||
- | left top | ||
- | left center | ||
- | left bottom | ||
- | right top | ||
- | right center | ||
- | right bottom | ||
- | center top | ||
- | center center | ||
- | center bottom | ||
- | |||
- | =====둥근 테두리===== | ||
- | ie9, 파폭, 크롬 등에서 지원함. | ||
- | <code css> | ||
- | /* 왼쪽위 */ | ||
- | | ||
- | -webkit-border-top-left-radius: | ||
- | -moz-border-radius-topleft: | ||
- | border-top-left-radius: | ||
- | | ||
- | /* 왼쪽아래 */ | ||
- | -webkit-border-bottom-left-radius: | ||
- | -moz-border-radius-bottomleft: | ||
- | border-bottom-left-radius: | ||
- | |||
- | / | ||
- | -webkit-border-top-right-radius: | ||
- | -moz-border-radius-topright: | ||
- | border-top-right-radius: | ||
- | /*오른쪽 아래*/ | ||
- | -webkit-border-bottom-right-radius: | ||
- | -moz-border-radius-bottomright: | ||
- | border-bottom-right-radius: | ||
- | </ | ||
- | =====Margin & Padding===== | ||
- | * margin 은 본문과 외부사이의 간격이다. | ||
- | * padding은 본문과 본문의 태두리와의 사이이구요. | ||
- | * border는 margin 과 padding 사이의 것이겠다. | ||
- | * **위 오른쪽 아래 왼쪽**; 순서대로 적을수 있다. | ||
- | |||
- | {{http:// | ||
- | ===== pt px em % 변환===== | ||
- | |||
- | px * 0.0626 = em | ||
- | |||
- | 예를 들면 | ||
- | |||
- | 15px * 0.0626 = 0.939em | ||
- | 77px * 0.0626 = 4.8em | ||
- | 80px * 0.0626 = 5.008em | ||
- | |||
- | |||
- | ^ Points ^ Pixels ^ Ems ^ Percent | | ||
- | | 6pt | 8px | 0.5em | 50% | | ||
- | | 7pt | 9px | 0.55em | 55% | | ||
- | | 7.5pt | 10px | 0.625em | 62.5% | | ||
- | | 8pt | 11px | 0.7em | 70% | | ||
- | | 9pt | 12px | 0.75em | 75% | | ||
- | | 10pt | 13px | 0.8em | 80% | | ||
- | | 10.5pt | 14px | 0.875em | 87.5% | | ||
- | | 11pt | 15px | 0.95em | 95% | | ||
- | | 12pt | 16px | 1em | 100% | | ||
- | | 13pt | 17px | 1.05em | 105% | | ||
- | | 13.5pt | 18px | 1.125em | 112.5% | | ||
- | | 14pt | 19px | 1.2em | 120% | | ||
- | | 14.5pt | 20px | 1.25em | 125% | | ||
- | | 15pt | 21px | 1.3em | 130% | | ||
- | | 16pt | 22px | 1.4em | 140% | | ||
- | | 17pt | 23px | 1.45em | 145% | | ||
- | | 18pt | 24px | 1.5em | 150% | | ||
- | | 20pt | 26px | 1.6em | 160% | | ||
- | | 22pt | 29px | 1.8em | 180% | | ||
- | | 24pt | 32px | 2em | 200% | | ||
- | | 26pt | 35px | 2.2em | 220% | | ||
- | | 27pt | 36px | 2.25em | 225% | | ||
- | | 28pt | 37px | 2.3em | 230% | | ||
- | | 29pt | 38px | 2.35em | 235% | | ||
- | | 30pt | 40px | 2.45em | 245% | | ||
- | | 32pt | 42px | 2.55em | 255% | | ||
- | | 34pt | 45px | 2.75em | 275% | | ||
- | | 36pt | 48px | 3em | 300% | | ||
- | |||
- | |||
- | ====줄이기 (...) ==== | ||
- | <file css> | ||
- | .ellipsis { width: 150px; text-overflow: | ||
- | </ | ||
- | |||
- | =====display===== | ||
- | |||
- | div 태그로 만든 Layer를 안보이게 하는 두가지 방법 | ||
- | |||
- | display: | ||
- | 아예 사라지게 하는것. 보이지도 않고 해당 공간도 존재하지 않게 됨 | ||
- | |||
- | visibility: | ||
- | 보이지만 않고 해당 공간은 존재. width와 height값을 주었다면 그만큼 공간은 존재하게 됨 | ||
- | |||
- | ====Float 탈출==== | ||
- | |||
- | 부모 div에 '' | ||
- | =====< | ||
- | 아직도 작동하지만 웹표준에서 삭제되었다. CSS를 이용한 정렬이 권장된다. | ||
- | |||
- | 내용물이 텍스트 인 경우 | ||
- | text-align: | ||
- | 내용물이 Div, Table 등인 경우 | ||
- | | ||
- | 를 사용한다. | ||
- | |||
- | =====CSS3 gradient===== | ||
- | |||
- | * [[http:// | ||
- | |||
- | |||
- | =====참조===== | ||
- | |||
- | * https:// | ||
- | |||
- | * [[http:// | ||
- | * [[http:// | ||
- | |||
- | {{tag> css html div center }} | ||
{{tag> | {{tag> |