CSS(4) | 목록열기
  • 디자인과 웹접근성 고려한 이미지 메뉴
  • 카테고리 : CSS    2007/05/15 17:29
  • 아래의 소스를 보면서 설명을 드리겠다.

     HTML 소스

    <ul class="menus">
      <li class="menu1"><a href="#">메뉴 1</a></li>
      <li class="menu2"><a href="#">메뉴 2</a></li>
    </ul>


    CSS 소스

    <style>
     .menus {   list-style:none; text-align:left; height:20px; overflow:hidden; display:inline;}
     .menus li {  list-style:none; display:inline;}
     .menus a {float:left; padding:20px 0 0 0; overflow:hidden; height:0px !important; height /**/:20px;  }
     .menus a:hover { background-position:0 -20px; }
     .menus a:active, .user_menu a.selected  { background-position:0 -20px; }

     .menu1 a { width:82px; background:url(http://image.yozmn.com/imgs/person/01/tbt_01_00.gif) top left no-repeat; }
     .menu1 a:hover { width:82px; background:url(http://image.yozmn.com/imgs/person/01/tbt_01_01.gif) top left no-repeat; }
     .menu1 a.selected { width:82px; background:url(http://image.yozmn.com/imgs/person/01/tbt_01_01.gif) top left no-repeat; }

     .menu2 a { width:82px; background:url(http://image.yozmn.com/imgs/person/01/tbt_03_00.gif) top left no-repeat; }
     .menu2 a:hover { width:82px; background:url(http://image.yozmn.com/imgs/person/01/tbt_03_01.gif) top left no-repeat; }
     .menu2 a.selected { width:82px; background:url(http://image.yozmn.com/imgs/person/01/tbt_03_01.gif) top left no-repeat; }
    </style>


    위의 소스는
    거의 완전한 웹접근성 (시각장애인 및 lynx 등에서)을 보장합니다.

    무척 복잡한 소스이긴 합니다만...
    대세가 그러하니 이런 방법도 적용해 보면 좋을듯합니다.


    위의 소스를 HTML로 작성해서 보시면 다음과 같이 작동합니다.



    사용자 삽입 이미지
    (일반적인 모습)

    사용자 삽입 이미지
    마우스 오버시 자바스크립트를 사용하지 않고도 위와 같은 효과를 내실 수도 있습니다.



    요세 CSS를 사용하지 않다보니..
    로그에 남길 필요성이 있어 작성해 봅니다.
  • 트랙백 0 : 덧글 1