차이

문서의 선택한 두 판 사이의 차이를 보여줍니다.

차이 보기로 링크

양쪽 이전 판이전 판
다음 판
이전 판
tech:css [2014/11/20 17:31] V_Ltech:css [2016/07/12 09:26] (현재) – 바깥 편집 127.0.0.1
줄 1: 줄 1:
-======CSS (Cascading Style Sheet)  Tips!======+{{tag>css}} 
 +======CSS (Cascading Style Sheet)   ======
 CSS(Cascading Style Sheet)는 마크업 언어가 실제 표시되는 방법을 기술하는 언어로, HTML과 XHTML에 주로 쓰이며, XML에서도 사용할 수 있다. W3C의 표준이며, 레이아웃과 스타일을 정의할 때의 자유도가 높다. CSS(Cascading Style Sheet)는 마크업 언어가 실제 표시되는 방법을 기술하는 언어로, HTML과 XHTML에 주로 쓰이며, XML에서도 사용할 수 있다. W3C의 표준이며, 레이아웃과 스타일을 정의할 때의 자유도가 높다.
  
줄 15: 줄 16:
  
  
 +    * [[CSS 초기화]] - CSS 간섭을 없앨때 사용.
 +    * [[CSS 말줄임 사용]]
 +    * [[Css 둥근테두리 사용]]
  
 http://twitter.github.io/bootstrap/scaffolding.html#gridSystem http://twitter.github.io/bootstrap/scaffolding.html#gridSystem
 http://www.divshot.com/ http://www.divshot.com/
  
 + 
  
-  *   <p style="text-decoration:underline;">밑줄긋기</p> 
-  *   <p style="text-decoration:overline;">윗줄긋기</p> 
-  *   <p style="text-decoration:line-through;">가운데줄긋기</p> 
-  *   <font style="vertical-align:sub;color:red;font-size:17pt">아래첨자</font> 
-  *   <font style="vertical-align:normal;color:red;font-size:17pt">걍~</font> 
-  *   <font style="vertica-align:super;color=blue;font-size:14pt;">위첨자</font> 
-  *     p.one{letter-spacing:3px; font-size:20px; }/*글자와 글자 사이 간격*/ 
-  *     p.two{word-spacing:30px; font-size:20px;}/*단어와 단어 사이의 간격*/ 
-  *     p.three{line-height:150%; font-size:20px;}/*줄간견으로 px과 %로 줄수 있음*/ 
-  *     <font style="text-transform:capitalize">영문자의 첫 글자만 대문자로 변화 sdagasdg agasdg</font> 
-  *     <font style="text-transform:uppercase">영문자의 모든 글자를 대문자로 변화 sDagasdg aGasdg</font>  
-  *     <p style="text-indent:20%">문자열 들여쓰기근영</font><!-- cm,pt,%등이 올수 있음-->  
-  *     클래스이름 
-  * {white-space:nowrap} /*자동 줄바꿈 방지*/ 
  
- 
-=====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: baseline; 
-    background: transparent; 
-}</code> 
- 
-아니면 다음과 같은 파일을 사용할 수도 있다.  
- 
-<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: inherit; 
-    font-style: inherit; 
-    font-size: 100%; 
-    font-family: inherit; 
-    vertical-align: baseline; 
-} 
-/* remember to define focus styles! */ 
-:focus { 
-    outline: 0; 
-} 
-body { 
-    line-height: 1; 
-    color: black; 
-    background: white; 
-} 
-ol, ul { 
-    list-style: none; 
-} 
-/* tables still need 'cellspacing="0"' in the markup */ 
-table { 
-    border-collapse: separate; 
-    border-spacing: 0; 
-} 
-caption, th, td { 
-    text-align: left; 
-    font-weight: normal; 
-} 
-blockquote:before, blockquote:after, 
-q:before, q:after { 
-    content: ""; 
-} 
-blockquote, q { 
-    quotes: "" ""; 
-}</file> 
 =====background===== =====background=====
 left top left top
줄 114: 줄 37:
 center bottom center bottom
  
-=====둥근 테두리===== 
-ie9, 파폭, 크롬 등에서 지원함. 
-<code css> 
-  /* 왼쪽위 */ 
-     
--webkit-border-top-left-radius: 15px; 
--moz-border-radius-topleft: 15px; 
-border-top-left-radius: 15px; 
-   
-  /* 왼쪽아래 */ 
-  -webkit-border-bottom-left-radius: 15px; 
--moz-border-radius-bottomleft: 15px; 
-border-bottom-left-radius: 15px; 
  
- /*오른쪽위*/ +===== 마진, 패딩 박스크기 ===== 
-      -webkit-border-top-right-radius: 15px; + 
--moz-border-radius-topright: 15px; +Margin & Padding 
-border-top-right-radius: 15px; +
-    /*오른쪽 아래*/ +
-    -webkit-border-bottom-right-radius: 15px; +
-    -moz-border-radius-bottomright: 15px; +
-    border-bottom-right-radius: 15px; +
-</code> +
-=====Margin Padding=====+
   * margin 은 본문과 외부사이의 간격이다.   * margin 은 본문과 외부사이의 간격이다.
   * padding은 본문과 본문의 태두리와의 사이이구요.   * padding은 본문과 본문의 태두리와의 사이이구요.
줄 144: 줄 48:
  
 {{http://www.avajava.com/tutorials/cascading-style-sheets/how-are-margins-borders-padding-and-content-related/how-are-margins-borders-padding-and-content-related-01.gif}} {{http://www.avajava.com/tutorials/cascading-style-sheets/how-are-margins-borders-padding-and-content-related/how-are-margins-borders-padding-and-content-related-01.gif}}
-===== pt px em % 변환===== 
  
-  px * 0.0626 em+결과적으로 최종으로 차지하는 크기는 넓이의 경우  
 +  마진왼쪽+마진오른쪽+테두리선왼쪽두께+테두리선오른쪽두께+패딩왼쪽+패딩오른쪽+상자넓이 XXX 
 +이런 식이다.. 이러니 크기를 계산하려면 산수를 해야 했다.
  
-를 들면 +이제  
-  +다 필요없고 최신 브라우져에서는 박스사이즈를 지원한다.  
-15px * 0.0626 = 0.939em  +padding에 상관 없이 지정한 크기로 유지된다 다음 코드를 추가한다
-77px * 0.0626 = 4.8em +
-80px * 0.0626 = 5.008em+
  
 +<file css>
 +html {
 + box-sizing: border-box;
 +}
  
-^ Points ^ Pixels ^ Ems ^ Percent | +*, *:before, *:after { 
-| 6pt | 8px | 0.5em | 50% | +  box-sizing: inherit; 
-| 7pt | 9px | 0.55em | 55% | +} 
-| 7.5pt | 10px | 0.625em | 62.5% | +</file>
-| 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% |+
  
 +{{:tech:css_sc_yoo1228091059.png}}
 +
 +jQuery 에서도 지원하므로 걱정없이 쓸 수 있다. 
 +
 +[참조] [[http://www.paulirish.com/2012/box-sizing-border-box-ftw/|Paul Irish]]
  
-====줄이기 (...) ==== 
-<file css> 
-.ellipsis { width: 150px; text-overflow: ellipsis; white-space: nowrap; overflow: hidden; } 
-</file> 
  
 =====display===== =====display=====
줄 201: 줄 84:
 보이지만 않고 해당 공간은 존재. width와 height값을 주었다면 그만큼 공간은 존재하게 됨 보이지만 않고 해당 공간은 존재. width와 height값을 주었다면 그만큼 공간은 존재하게 됨
  
-====Float 탈출==== 
  
-부모 div에 ''overflow:hidden'' 추가 
 =====<Center> tag===== =====<Center> tag=====
 아직도 작동하지만 웹표준에서 삭제되었다. CSS를 이용한 정렬이 권장된다. 아직도 작동하지만 웹표준에서 삭제되었다. CSS를 이용한 정렬이 권장된다.
줄 226: 줄 107:
  
  
-{{tag>css}}+