크롬에서 input 태그 사용시 type을 number로 지정할 경우

input field 우측에 숫자 증감에 필요항 콤포넌트가 생성된다.

이게 문제가 되는게 숫자를 우측정렬했음에도 불구하고 readonly 상태의 값이 우측 정렬이 아닌 가운데 정렬로 보일정도로

이 콤포넌트가 공간을 많이 차지하게 된다.


input type number로 지정했을 경우 입력 시 -> 

readonly 상태에서 숫자를 우측정렬했음에도 불구하고 거의 가운데에 위치한 것처럼 여백이 생긴다. 


그래서 이 아이를 없앨 수 있는 css는 


input[type=number]::-webkit-outer-spin-button{-webkit-appearance: none;margin: 0;}

input[type=number]::-webkit-inner-spin-button{-webkit-appearance: none;margin: 0;}


위와 같이 넣어주면 된다.

done.

출처 : http://webdir.tistory.com/31


콘텐츠를 가운데 정렬하는 일은 굉장히 빈번한 일입니다. 부모 혹은 자식 요소에 따라 이를 구현하는 방법이 상이하니 염두해 둡시다.

기본적인 내용 정렬

가운데 정렬을 알아보기 앞서, 가장 간단한 정렬방법을 알아봅니다.

내용 가로 정렬

내용을 <p> 같은 종결 블록 요소의 왼쪽, 중앙, 오른쪽, 양쪽에 정렬한다.

CSS
.align-left { text-align: left; }
.align-center { text-align: center; }
.align-right { text-align: right; }
.align-justify { text-align: justify; }
  • 내용이 든 종결 블록 요소에만 적용된다.
  • 인라인 요소에 적용되지 않으며, 구조 블록 요소에는 제대로 적용되지 않는다.
  • 구조 블록 요소에 text-align 속성을 지정하면 그 속성값은 자식 요소로 상속된다.

내용 세로 정렬

인라인 요소를 부모 요소의 네 폰트라인 중 하나에 맞추려면 vertical-align 속성을 이용한다.

폰트라인은 인라인 내용을 맞출 수 있는 기준 위치 네 군데를 뜻한다. 이 기준 위치에 따라 정렬 콘텍스트라는 것이 형성된다.

가로 중앙 정렬

인라인 요소는 text-align 속성을 이용해서 가운데 정렬이 가능하지만 블럭 요소들은 중앙 정렬되지 않습니다.

고정폭의 블럭 요소 중앙 정렬

auto값은 요소 안의 마진 여백이 왼쪽 마진과 오른쪽 마진 사이에서 대등하게 나눠짐을 의미한다.

CSS
p {
  width: 100px; /* 정렬하려는 요소의 넓이를 반드시 지정 */
  margin: 0 auto;
}

Quirks Mode를 대비한 중앙정렬은 아래와 같다.

CSS
body {
  text-align: center; /* Quirks Mode 를 위한 가운데 정렬 */
}

p {
  text-align: left; /* 문자들의 가운데 정렬을 해제 */
  width: 100px;
  margin: 0 auto;
}

가변폭의 컨테츠를 중앙 정렬

너비가 고정되어 있지 않는 콘텐츠를 가운데 정렬하는 방법입니다.

ie8 이상, modern-browser를 위한 방법

가운데 정렬이 되는 것은 item 클래스의 요소이다. 인라인 요소도 가능

HTML
<style>
  .centered { display: table; margin-left: auto; margin-right: auto; }
</style>

<div class="centered">
  <div class="item">block item</div>
</div>
ie 6~7 호환

가운데 정렬 시킬 대상은 item 클래스의 요소이다. 이 방법은 inline-block을 사용하는데 ie 6~7은 지원이 완벽하지 않아서 원래 inline인 요소에 한해서만 inline-block을 사용할 수 있다. 그래서 span 태그를 사용하여 item클래스의 요소를 감쌌으며 인라인 요소는 블럭요소를 포함할수 없다는 기본 문법에 따라 item클래스의 요소도 인라인 요소로 대체되었다.

HTML
<style>
  .centeringContainer { text-align: center; }
  .centered { display: table; margin-left: auto; margin-right: auto; display: inline-block; }
</style>

<div class="centeringContainer">
  <span class="centered">
    <span class="item" style="display:block">block item</span>
  </span>
</div>

centered 클래스에 display 속성이 두 번 사용되었는데, 이 경우 마지막에 쓰여진 display: inline-block이 적용된다. 단, Firefox 2에서는 inline-block을 이해하지 못하므로 그 전에 적힌 display: table이 적용된다. 그래서 inline-block을 지원하지 않는 브라우저는 display: table과 margin을 적용받아 가운데 정렬이 되고, 나머지 브라우저에서는 text-align: center와 display: inline-block이 적용되어 가운데 정렬이 된다.

포지션이 absolute일때 중앙 정렬

  • left의 값을 50% 으로 잡기
  • margin-left의 값을 정렬하려는 div등의 넓이값/2 나누고 음수(-)값을 입력

ex. div width:400px면 400/2 = 200을 마진값으로 설정 margin-left:-200px

HTML
<style>
  .centered { width: 400px; position: absolute; left: 50%; margin-left: -200px; }
</style>

<div class="centered">absolute 가운데 정렬</div>

포지션이 absolute일때 너비가 고정되지 않은 경우

transform 속성을 활용하여 요소의 너비의 절반만큼을 이동시킬 수 있다.

HTML
<style>
  .centered { position: absolute; left: 50%; transform: translateX(-50%); }
</style>

<div class="centered">transform 가운데 정렬</div>

transform 속성은 IE9 이상의 IE 브라우저와 그 밖의 모던 브라우저들에서 작동하며, IE9는 prefix인 -ms- 를 필요로한다.

포지션이 absolute일때 중앙 정렬(가로 중앙 정렬 + 세로중앙 정렬)

HTML
<style>
  div { position:relative; }
  #cm { position:absolute; }
  .hc { width:200px; left:0; right:0; margin-left:auto; margin-right:auto; } /* 가로 중앙 정렬 */
  .vc { height:40px; top: 0; bottom:0; margin-top:auto; margin-bottom:auto; } /* 세로 중앙 정렬 */
</style>

<div>
  <p id="cm" class="hc vc">가로 중앙 정렬 + 세로 중앙 정렬</div>
</div> 

IE7 이하 버전은 왼쪽 맞추기와 오른쪽 맞추기를 동시에 지원하지 않고 상단 맞추기와 하단 맞추기를 동시에 지원하지 않으므로 이 패턴이 적용되지 않는다.

세로 중앙 정렬

페이지의 높이가 유동적으로 늘어나거나 줄어들기 때문에 요소안의 요소를 세로 중앙 정렬하는 것은 어려운 일입니다. 각각의 상황에 따라 알맞게 사용하기를 바랍니다.

테이블안의 요소 정렬

CSS
table { vertical-align: middle; }

div태그의 display속성을 table로 설정하는 방법

테이블처럼 만들어서 테이블의 vertical-align 속성을 사용할 수 있도록 <div>를 몇개 셋팅한다. 이렇게 함으로써 div 태그에 table 속성에 있는 vertical-align 속성을 설정할 수 있다.

HTML
<style>
  #wrapper { display: table; }
  #cell { display: table-cell; vertical-align: middle; }
</style>

<div id="wrapper">
  <div id="cell">
    <div class="content">Content goes here</div>
  </div>
</div>
  • 높이가 변해도 상관없다(CSS에 높이를 지정하지 않아도 된다).
  • wrapper에 공간이 없어도 내용이 잘리지 않는다.
  • IE7 이하에서 작동하지 않는다.
  • 태그 단계가 깊어진다(그렇게 나쁜 건 아니다. 이건 주관적인 부분이다).

한 줄에 여러 요소를 넣어야 할 때는 display: table 대신 display: inline-table을 사용할 수도 있다.

absolute 속성을 이용하는 방법

이번에는 absolute 속성을 이용하여 top 속성에 50%를 주어 콘텐츠를 내리고 margin을 이용하여 콘텐츠 높이의 절반을 margin-top:-120px;이와같이 음수값을 이용한다. 그럼으로써 높이를 고정시킬 수 있다. 이것은 요소의 높이를 CSS에서 지정해야 한다는 걸 의미한다.

HTML
<style>
  #content { position: absolute; top: 50%; height: 240px; margin-top: -120px; }
</style>

<div id="content">Content Here</div>

높이를 지정해 두기 때문에, 내용이 넘치면 div 밖으로 튀어나간다. 대신에 스크롤바가 생기도록 콘텐츠 div에 overflow: auto를 주고 싶을 것이다.

  • 모든 브라우저에서 작동한다.
  • 태그가 깊이 들어가지 않는다.
  • 충분한 공간이 없으면 내용이 잘린다(div가 body 밑에 있고, 사용자가 브라우저 창을 줄이면, 스크롤바가 나타나지 않는다).
포지션이 absolute일때 높이가 고정되지 않은 경우

transform 속성을 활용하여 요소의 높이의 절반만큼을 이동시킬 수 있다.

HTML
<style>
  .centered { position: absolute; top: 50%; transform: translateY(-50%); }
</style>

<div class="centered">transform 세로 가운데 정렬</div>

float 속성을 이용하는 방법

이 방법은 내용 요소 위에 div를 두는 방법이다. 이 div는 height: 50%;margin-bottom:-content높이의절반 이렇게 설정한다. content엔 clear 속성을 줘서 float된 div 밑으로 오게 하면 content가 가운데 오게 된다.

HTML
<style>
  #floater {float:left; height:50%; margin-bottom:-120px;}
  #content  {clear:both; height:240px; position:relative;}
</style>

<div id="floater"></div>
<div id="content">
  Content Here    
</div>
  • 모든 브라우저에서 작동한다.
  • 충분한 공간이 없을 때 (예컨대 윈도우 사이즈를 줄일 때) 콘텐츠가 잘리고 스크롤바가 나타난다.
  • 내가 생각할 수 있는 유일한 단점은, 빈 요소가 사용된다는 점이다(그렇게 나쁜 건 아니다. 이것 역시 주관적인 부분이다).

line-height 속성을 이용하는 방법

이 방법은 박스 안의 텍스트가 한 줄일 경우에만 유효하다. 박스의 높이값과 line-height를 동일하게 부여한다.

HTML
<style>
  #content { height: 100px; line-height: 100px; }
</style>

<div id="content">Content Here</div>
  • 모든 브라우저에서 작동한다.
  • 공간이 없어도 잘리지 않는다.
  • 오직 텍스트에서만 작동한다(블럭 요소에선 작동하지 않는다).
  • 한 줄 이상이 되면 (즉, 두 줄이 되면), 보기 싫게 깨진다.

이미지를 가운데 정렬 시키는 방법

이번 예제는 ie에서도 적용되는 예제이다.

HTML
<style>
  .vCenter { display: table; width: 400px; height: 400px; border: 1px solid red; }
   .vCenter span { display: table-cell; text-align: center; vertical-align: middle; }
</style>

<!--[if lt IE 8]>
<style>
  .vCenter { position:relative; }
  .vCenter span { display:inline-block; position:absolute; top:50%; left:50%; }
  .vCenter span a { position:relative; top:-50%; left:-50%; }
</style>
<![endif]-->

<div class="vCenter">
  <span>
    <a href="#">
      <img src="thumbnails.jpeg" alt="이미지">
    </a>
  </span>
</div>

타인의 소스를 분석하다 발견한 새로운 가로 및 세로 중앙 정렬 방법을 설명한다. 업데이트 2015-06-27

:before 를 이용한 가운데 정렬

가상선택자인 :before를 정렬할 요소의 부모에 컨테이너에 추가해 그것의 높이를 100%로 지정하고 그것의 세로 정렬의 값을 middle로 설정해 이후 등장하는 요소가 세로 중앙정렬 되도록 하는 것이다.

HTML
<style>
  .wrapper {height: 100%; text-align: center;}
  .wrapper:before { content: ""; display: inline-block; width: 1px; height: 100%; margin-right: 0; vertical-align: middle;}
  .content { display: inline-block; }
</style>

<div class="wrapper">
  <div class="content">콘텐츠</div>
</div>
정확한 가운데 정렬이 아니라 추가 수정이 필요하다.



출처: http://webdir.tistory.com/31 [WEBDIR]

출처: http://webdir.tistory.com/31 [WEBDIR]

출처: http://webdir.tistory.com/31 [WEBDIR]

대략 설명해보자면 이런 그림이 되시겠다.


[ 좌측] [메뉴1][메뉴2][메뉴3] [우측]


여기서 포인트는 좌,우는 px로 고정하고 가운뎃부분 메뉴 부분이 ul li로 구성하되 브라우저 크기만큼 유연하게 확장되길 원한다.

정리하자면 가운데부분이 반응형!!!


마크업은 이렇다.

<div class="wrap">

  <div class="left">left</div>

  <ul class="list">

    <li style="background:red">item1</li>

    <li style="background:blue">item2</li>

    <li style="background:yellow">item3</li>

  </ul>

  <div class="right">right</div>

</div>


css는 이렇다.

html * {padding:0; margin:0}

ul,li {list-style:none;}

.wrap {display:table; width:100%; padding:0 10px; box-sizing:border-box;}

.left {display:table-cell; width:100px; background: #ddd}

.right {display:table-cell; width:200px; background: #ddd}

.list {display: table; width: 100%}

.list li {display: table-cell; width: 33.3%}



참 쉽죠~~잉? (그래! 난 이걸 몰라서 선배 괴롭혀서 얻어냈다 ㅡㅜ)


퍼블의 세계는 신기하고 놀라워!!!


암튼 jsfiddle이나 codepen을 이용해서 미리보기하면 된당.


그럼 즐퍼블~~


출처 : https://kimblim.dk/css-tests/selectors/

CSS SELECTORS AND PSEUDO SELECTORS BROWSER COMPATIBILITY

This page has not been updated for some time and some of the browser versions are obsolete - I'm working on a better format for the page, so check back every now and then :)

The following is a range of CSS tests of the most common browsers' support for selectors and pseudo selectors. The tests includes basic stuff from the good old days of CSS1 and funky stuff from the future (CSS3). If you feel like reading more about the selectors and which attributes they support, the W3C is the place to go!

If you spot any errors (it happens to us all...) or have any comments, I'm on Twitter as @overflowhidden.

Click here to see this page's history.

CSS 1
↓ Selector / Browser →IE6IE7IE8IE9 previewFF 3FF 3.5FF 3.6Safari 3Safari 4Chrome 5 betaOperaOpera 10.5 beta
↑ Selector / Browser →IE6IE7IE8IE9 previewFF 3FF 3.5FF 3.6Safari 3Safari 4Chrome 5 betaOperaOpera 10.5 beta
EYESYESYESYESYESYESYESYESYESYESYESYES
E FYESYESYESYESYESYESYESYESYESYESYESYES
:linkYESYESYESYESYESYESYESYESYESYESYESYES
E:activeYESYESYESYESYESYESYESYESYESYESYESYES
E:visitedYESYESYESYESYESYESYESYESYESYESYESYES
E:first-lineNOYESYESYESYESYESYESYESYESYESYESYES
E:first-letterNOYESYESYESYESYESYESYESYESYESYESYES
E.classnameYESYESYESYESYESYESYESYESYESYESYESYES
E#idYESYESYESYESYESYESYESYESYESYESYESYES
.classname.classnameNOYESYESYESYESYESYESYESYESYESYESYES
CSS 2.1
↓ Selector / Browser →IE6IE7IE8IE9 previewFF 3FF 3.5FF 3.6Safari 3Safari 4Chrome 5 betaOperaOpera 10.5 beta
↑ Selector / Browser →IE6IE7IE8IE9 previewFF 3FF 3.5FF 3.6Safari 3Safari 4Chrome 5 betaOperaOpera 10.5 beta
*YESYESYESYESYESYESYESYESYESYESYESYES
E > FNOYESYESYESYESYESYESYESYESYESYESYES
E:first-childNOYESYESYESYESYESYESYESYESYESYESYES
E:hoverPARTIAL (1)YESYESYESYESYESYESYESYESYESYESYES
E:focusNONOYESYESYESYESYESYESYESYESYESYES
E + FNOYESYESYESYESYESYESYESYESBUGGY (5)YESYES
E[attr]NOYESYESYESYESYESYESYESYESYESYESYES
E[attr="name"]NOYESYESYESYESYESYESYESYESYESYESYES
E[attr~="name"]NOYESYESYESYESYESYESYESYESYESYESYES
E:beforeNONOYESYESBUGGY (4)YESYESYESYESYESYESYES
E:afterNONOYESYESBUGGY (4)YESYESYESYESYESYESYES
CSS 3
↓ Selector / Browser →IE6IE7IE8IE9 previewFF 3FF 3.5FF 3.6Safari 3Safari 4Chrome 5 betaOperaOpera 10.5 beta
↑ Selector / Browser →IE6IE7IE8IE9 previewFF 3FF 3.5FF 3.6Safari 3Safari 4Chrome 5 betaOperaOpera 10.5 beta
E ~ FNOYESYESYESYESYESYESYESYESYESYESYES
E[attr^="name"]NOYESYESYESYESYESYESYESYESYESYESYES
E[attr$="name"]NOYESYESYESYESYESYESYESYESYESYESYES
E[attr*="name"]NOYESYESYESYESYESYESYESYESYESYESYES
E[attr|="name"]NOYESYESYESYESYESYESYESYESYESYESYES
E:rootNONONOYESYESYESYESYESYESYESYESYES
E:nth-of-typeNONONOYESNOYESYESYESYESYESYESYES
E:nth-last-of-typeNONONOYESNOYESYESYESYESYESYESYES
E:first-of-typeNONONOYESNOYESYESYESYESYESYESYES
E:last-of-typeNONONOYESNOYESYESYESYESYESYESYES
E:only-of-typeNONONOYESNOYESYESYESYESYESYESYES
E:only-childNONONOYESYESYESYESYESYESYESYESYES
E:last-childNONONOYESYESYESYESYESYESYESYESYES
E:nth-childNONONOYESNOYESYESYESYESYESYESYES
E:nth-last-childNONONOYESNOYESYESYESYESYESYESYES
E:emptyNONONOYESYESYESYESBUGGY (2)YES (3)YESYESYES
E:targetNONONOYESYESYESYESYESYESYESYESYES
E:checkedNONONOYESYESYESYESYESYESYESYESYES
E::selectionNONONOYESNONONOYESYESYESYESYES
E:enabledNONONOYESYESYESYESYESYESYESYESYES
E:disabledNONONOYESYESYESYESYESYESYESYESYES
E:not(s)NONONOYESYESYESYESYESYESYESYESYES
  1. :hover only works for a-elements in IE6.
  2. E:empty seems to have some buggy behaviour in webkit-based browsers.
  3. Not sure how to test if this is still buggy.
  4. Tim has informed that the :before and :after selectors are buggy in Firefox versions before 3.5. Apparently they do not allow inserted elements to have fixed width/height or absolute positioning. I haven't checked this out myself. Thanx, Tim! Update: It certainly seems as if Tim is right - in Nicolas Gallaghers great demo about multiple backgrounds using CSS2.1, he also points this out.
  5. It seems that Chrome (at least on a Mac) has some issues with the adjacent selectors - I've created a test page to demonstrate it. It does not seem to be a Webkit issue, as Safari has no issues with this.
History (not complete):
2011.04.13: I've discovered a bug in Google Chrome regarding the adjacent selectors and created a test page to demonstrate the problem. The bug is fixed in v11 of Chrome.
2010.03.18: Opera 10b3 replaced with Opera 10.5 betaChrome 2 replaced with Chrome 5 betaFirefox 2 replaced with Firefox 3.6Internet Explorer 9 developer preview added.
2009.08.19: Konqueror removed as I have no way of testing it. Opera 10 beta added. Test for :not added.
2009.08.05: Firefox 3.5 beta 4 replaced with the final version. Chrome 1 replaced with Chrome 5 beta. Also changed lightbox functionality.
2009.06.15: Firefox 3.5 beta 4 added to the matrix
2009.06.11: Safari 4 beta replaced with the final version
2009.03.17: Safari 4 beta added
2009.03.04: Completely redone! New matrix overview, more selectors, better tests, more browsers. Removed min-width and max-width as they are not selectors.
2008.10.31: Internet Explorer 8 beta 2 added - major improvements compared to IE7!
2008.09.11: Google Chrome added
2008.06.27: Removed Firefox1.5 and inserted Firefox 3 instead. Also updated all the Safari tests to Safari3.
2007.07.13: Corrected the :checked test. Seems as if Firefox does support the selector, it just doesn't support red borders on checkboxes...
2007.03.16: Added :checked test
2007.01.12: I have added Konqueror 3.5.5 - which aces all the tests!
2007.01.09: I have added Firefox 2.0.0.1
2007.01.04: Added :nth-child test
2007.01.04: Improved the examples for :min-width and :max-width.
2007.01.02: I have added Opera 9.10 and there are some stats at the bottom of the page now...
2006: Created...


html

<div class="wrap">

    <div class="align_center">

        <p>가운데정렬<br>div</p>

    </div>

</div>



style

<style>

    .wrap { width:100%; position:relative; background:#7f7f7f; }

    .align_center { width:300px; height:200px; position:absolute; background:#f7c709; top:50%; left:50%; margin:-100px 0 0 -150px; text-align:center; }

</style>




소스설명드리겠습니다!

우선 wrap의 css를 살펴보면, position:relative; 라고 되어있는데, 이것은 공중에 띄울(position:absolute;) div의 기준점

되겠다는 의미입니다. 공중에 띄우기위해선 반드시 기준점이 있어야합니다.


wrap의 div에 position:relative;를 주었기때문에 wrap div의 x좌표 : 0, y좌표 : 0이 기준점이 됩니다.


다음으로 align_center의 css를 살펴보면, position:absolute;라고 되어있죠?

이부분은 relative되어진 div로부터 어느지점에 절대값으로 띄워져있겠다는 의미입니다.

그 지점을 top, left, right, bottom으로 표시하는데, 위 예제에선 top:50%; left:50%라고 되어있습니다.


위에서부터 50%만큼, 왼쪽에서부터 50%만큼 띄우겠다는것이죠. 물론 px로도 조절하실 수 있습니다.


또, margin:-100px 0 0 -150px;라고되어있는데, 이부분은 align_center div가 위에서 50%, 왼쪽에서 50%만큼

띄워져있기때문에 자신의 가로사이즈의 절반만큼, 세로사이즈의 절반만큼 움직여줘야 딱! 중앙정렬이 되는것입니다.


참고로 margin:위px 오른쪽px 아래px 왼쪽px; 입니다.

그럼 위로 -100px만큼, 왼쪽으로 -150px만큼 움직여서 가운데정렬이되는것입니다!


간단하죠? 글로 설명드리니까 조금 길어진것같지만 한번 실습해보시면 굉장히 쉽다는것을 알게되실겁니다 ㅎㅎ

여기까지 div 가운데 정렬하기에대해서 알아보았습니다!


해보시고 잘 안되거나 이 예제가아니더라도 궁금한부분이있으면 댓글남겨주세요^^

도움이되었다면 공감 꾸욱!



출처: http://two-leaves.tistory.com/?page=2 [새싹에서 열매까지]


출처 : http://naradesign.net/open_content/reference/navigation.html


가로로된 메뉴 마우스 오버시 하위 메뉴 나오게 하는 소스

세로로된 메뉴 클릭하면 하위메뉴 보여지도록 펼쳐지는 소스


<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml" lang="ko">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>웹 접근성이 고려된 중첩된 ul 메뉴 네비게이션 가로 및 세로 예제</title>
<script type="text/javascript">
<!--
//글로벌 네비게이션(2Depth 메뉴그룹)에 대한 마우스 또는 키보드 반응(보임/숨김)설정
function activeGNB(id) {
for(num=1; num<=4; num++) document.getElementById('gm'+num).style.display='none'; //D2MG1~D2MG4 까지 숨긴 다음
document.getElementById(id).style.display='block'; //해당 ID만 보임
}
//로컬 네비게이션(4Depth 메뉴그룹)에 대한 마우스 또는 키보드 반응(보임/숨김)설정
function activeLNB(id) {
for(num=1; num<=4; num++) document.getElementById('lm'+num).style.display='none'; //D4MG1~D4MG4 까지 숨긴 다음
document.getElementById(id).style.display='block'; //해당 ID만 보임
}
//-->
</script>
<style type="text/css">
/* 공통사항 초기화 - 모든 색상값들은 레이아웃 영역과 문자를 표시하기 위하여 임의로 설정됨 */
* { margin:0; padding:0; border:0; }
ul { list-style:none }
ol { margin:0 0 20px 20px; line-height:150% }
body { margin:10px; color:#FFFFFF; font-size:small; font-family:'돋움', sans-serif; height:100% }
a { color:#FFFFFF; text-decoration:none }
a:hover,
a:focus,
a:active { color:#FFFF00; text-decoration:underline; font-weight:bold }
h1 { font-size:50px; font-family:Arial; font-weight:bold; position:relative; padding:10px 20px; width:200px; }
h2 { font-size:30px; font-family:Arial; font-weight:bold; border-bottom:1px solid #000000; background:#666666; padding:5px; line-height:100%; margin-bottom:20px }
p { margin-bottom:20px }
hr { display:none }

/* 레이아웃 */
#logo { background:#000000 }
#gnb { position:relative; height:60px; background:#333333; margin-bottom:10px; }
#body { padding-left:220px;}
#body:after { content:""; display:block; clear:both; }
#lnb { position:relative; left:-220px; float:left; width:200px; margin:0 -200px 10px 0 }
#content { position:relative; background:#999999; margin-bottom:10px; text-align:justify; padding:20px }
#copyright { clear:both; background:#999999; font-size:30px; font-weight:bold; }

/* 메뉴를 건너 뛰고 페이지 본문으로 이동하기 */
#skipToContent { position:relative;}
#skipToContent a { display:block; height:1px; width:1px; margin-bottom:-1px; overflow:hidden; text-align:center; color:#000; white-space:nowrap;}
#skipToContent a:focus,
#skipToContent a:active { height:auto; width:auto; padding:5px; margin-bottom:10px;}

/* 페이지 맨 위로 이동하기 */
#returnToPageTop { position:relative; }
#returnToPageTop a { display:block; height:1px; width:1px; margin-bottom:-1px; overflow:hidden; text-align:center; color:#000; white-space:nowrap; }
#returnToPageTop a:focus,
#returnToPageTop a:active { height:auto; width:auto; padding:5px; margin-bottom:10px;}

/* 글로벌 메뉴 배치 */
#gnb:after { content:""; display:block; clear:both; }
#gnb li { float:left; width:25%; text-align:center; }
#gnb li li { float:left; width:auto; text-align:left; }
#gnb li a { display:block; height:20px; padding-top:10px;}
#gnb li li a { display:inline; height:auto; padding:0; margin:0 10px; }
#gnb li.g1 { background:#666600 }
#gnb li.g2 { background:#669900 }
#gnb li.g3 { background:#66CC00 }
#gnb li.g4 { background:#FFCC00 }
#gnb ul { position:relative;}
#gnb ul ul { position:absolute; top:38px; display:none; white-space:nowrap; }
#gnb ul#gm1 { left:0; }
#gnb ul#gm2 { left:25%; }
#gnb ul#gm3 { left:50%; }
#gnb ul#gm4 { left:75%; }

/* 글로벌 메뉴 활성 */
#gnb .active ul { display:block; }
#gnb .active a { text-decoration:underline; }
#gnb .active li a { text-decoration:none; }
#gnb .active .active a { text-decoration:underline; }

/* 로컬 메뉴 활성 */
#lnb .active ul { display:block; }
#lnb .active a { text-decoration:underline; }
#lnb .active li a { text-decoration:none; }
#lnb .active .active a { text-decoration:underline; }

/* 페이지 중간 */
#middle { display:block; width:800px; overflow:hidden; }

/* 로컬 네비게이션 */
#lnb li a { display:block; width:180px; padding:10px; border-bottom:1px solid #FFFFFF; background: #000033 }
#lnb li ul { display:none }
#lnb li li a { display:block; width:170px; padding:5px 10px 5px 20px; border-bottom:1px solid #FFFFFF; background:#006699; }
</style>
<!--[if IE]>
<style type="text/css">
#body,
#gnb,
#gnb li a,
#gnb ul{ zoom:1;}
#gnb ul ul{ _width:100%;}
</style>
<![endif]-->
</head>
<body>
<div id="container">
<div id="skipToContent"><a href="#content">메뉴 건너 뛰기</a></div>
<div id="logo">
<h1><a href="#">Logo</a></h1>
</div>
<hr />
<div id="gnb">
<ul>
<li class="g1 active"><a href="#" onmouseover="activeGNB('gm1');" onfocus="activeGNB('gm1');">메뉴 1</a>
<ul id="gm1">
<li class="active"><a href="#">메뉴 1_1 입니다</a></li>
<li><a href="#">메뉴 1_2</a></li>
<li><a href="#">메뉴 1_3</a></li>
</ul>
</li>
<li class="g2"><a href="#" onmouseover="activeGNB('gm2');" onfocus="activeGNB('gm2');">메뉴 2</a>
<ul id="gm2">
<li><a href="#">메뉴 2_1</a></li>
<li><a href="#">메뉴 2_2 입니다</a></li>
<li><a href="#">메뉴 2_3</a></li>
</ul>
</li>
<li class="g3"><a href="#" onmouseover="activeGNB('gm3');" onfocus="activeGNB('gm3');">메뉴 3</a>
<ul id="gm3">
<li><a href="#">메뉴 3_1</a></li>
<li><a href="#">메뉴 3_2</a></li>
<li><a href="#">메뉴 3_3 입니다</a></li>
</ul>
</li>
<li class="g4"><a href="#" onmouseover="activeGNB('gm4');" onfocus="activeGNB('gm4');">메뉴 4</a>
<ul id="gm4">
<li><a href="#">메뉴 4_1 입니다</a></li>
<li><a href="#">메뉴 4_2</a></li>
<li><a href="#">메뉴 4_3</a> </li>
</ul>
</li>
</ul>
</div>
<hr />
<div id="body">
<div id="lnb">
<ul>
<li class="active"><a href="#" onfocus="activeLNB('lm1')">메뉴 1_1_1</a>
<ul id="lm1">
<li class="active"><a href="#">메뉴 1_1_1_1</a></li>
<li><a href="#">메뉴 1_1_1_2</a></li>
<li><a href="#">메뉴 1_1_1_3</a> </li>
</ul>
</li>
<li><a href="#" onfocus="activeLNB('lm2')">메뉴 1_1_2</a>
<ul id="lm2">
<li><a href="#">메뉴 1_1_2_1</a></li>
<li><a href="#">메뉴 1_1_2_2</a></li>
<li><a href="#">메뉴 1_1_2_3</a> </li>
</ul>
</li>
<li><a href="#" onfocus="activeLNB('lm3')">메뉴 1_1_3</a>
<ul id="lm3">
<li><a href="#">메뉴 1_1_3_1</a></li>
<li><a href="#">메뉴 1_1_3_2</a></li>
<li><a href="#">메뉴 1_1_3_3 </a></li>
</ul>
</li>
<li><a href="#" onfocus="activeLNB('lm4')">메뉴 1_1_4</a>
<ul id="lm4">
<li><a href="#">메뉴 1_1_4_1</a></li>
<li><a href="#">메뉴 1_1_4_2</a></li>
<li><a href="#">메뉴 1_1_4_3</a> </li>
</ul>
</li>
</ul>
</div>
<hr />
<div id="content">
<h2>Title</h2>
<ol>
<li>웹 표준을 준수하고 나아가 일반인 및 장애인에 대한 웹 접근성을 극대화 하기 위하여 그리고 이러한 방법이 그리 어렵지 않다는 것을 널리 알릴 목적으로 제작되었습니다. </li>
<li>현존하는 대중적인 브라우저에 대하여 호환성을 유지하였습니다. </li>
<li>Tab 키를 이용하여 모든 메뉴를 선택할 수 있습니다. </li>
<li>Tab 키를 이용하여 모든 메뉴를 건너 뛸 수 있습니다. </li>
<li>Tab 키를 이용하여 하위 메뉴를 펼치거나 숨길 수 있습니다.</li>
<li>Tab 키를 이용하면 메뉴를 건너뛰어 페이지 본문으로 바로 이동할 수 있습니다. </li>
<li> <img src="http://www.w3.org/Icons/valid-xhtml10" alt="Valid XHTML 1.0 Strict" width="88" height="31" /> <img style="border:0;width:88px;height:31px" src="http://jigsaw.w3.org/css-validator/images/vcss" alt="Valid CSS!" /> 이 마크는 현재의 페이지가 W3C의 XHTML 1.0 표준과 CSS 표준을 준수 했음을 나타냅니다.</li>
<li>현재 페이지의 XHTML 1.0 유효성 검사를 하려면 <a href="http://validator.w3.org/check?uri=http%3A//naradesign.com/2006/open_content/css_reference/CSS_Nested_UL_Navigation_060311.html">&quot;Markup Validation&quot;</a>을 클릭하세요. </li>
<li>현재 페이지의 CSS 유효성 검사를 하려면 <a href="http://jigsaw.w3.org/css-validator/validator?uri=http%3A//naradesign.com/2006/open_content/css_reference/CSS_Nested_UL_Navigation_060311.html&amp;usermedium=all">&quot;CSS Validation&quot;</a>을 클릭하세요. </li>
</ol>
<p>제작 <a href="http://naradesign.net/">http://naradesign.net/</a> 정찬명 </p>
</div>
</div>
<hr />
<div id="copyright"> Copyright </div>
<div id="returnToPageTop"><a href="#skipToContent">페이지 맨 위로 이동</a></div>
</div>
</body>
</html>


좌측을 px로 고정하고 우측을 유동적으로 % 설정하여 페이지 구성 시 방법



input field에 자동입력이나 텍스트를 입력한 경우

webkit 기반 브라우저에서는 기본적으로 컬러가 지정되어 깔린다.

이를 초기화 활 수 있는 코드를 알려준다.



input:-webkit-autofill,

input:-webkit-autofill:hover,

input:-webkit-autofill:focus,

input:-webkit-autofill:active {

    transition: background-color 5000s ease-in-out 0s;

}


DONE!

http://unikys.tistory.com/369?category=478873

높이 100% 만들기 예제 입니다.

처음 코딩을 할때 css로 높이 100%채우기 검색해도 안나와서 jquery로 해결 했었는데 방법이 있네요 !!

아주 간단하게 css만으로 높이 100%가 가능합니다.

왼쪽메뉴의 배경이 있는형태의 사이트 작업시에 유용하게 사용될거 같습니다.

 

#wrap{overflow:hidden; position:relative; width:1000px; margin:0 auto;}
#left_area{position:absolute; top:0px; left:0px; bottom:0px; width:200px; color:#FFFFFF; background:black;}
#content{float:right;  display:block; width:750px; min-height:1000px;}

 

<section id="wrap">
 <div id="left_area">왼쪽영역</div>
 <div id="content">컨텐츠영역</div>
</section>


출처 : http://hompylove.com/system/bbs/board.php?bo_table=tip&wr_id=25

+ Recent posts