padding을 이용하여서 메뉴 만들기

menu_blog.png

다음과 같이 이미지를 만들어서
기존에는 위에 이미지를 ,
마우스 오버시 밑에 이미지를 보여주게 하고 싶어요.

가능할까요?

padding을 교묘하게 이용하면 될것같은데
제가 해보니 잘 안되네요.

제가 해본 소습니다.

틀린부분 고쳐주세용

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<style type="text/css">
li {list-style:none;}
img {border:none;}
#menu {margin:10px; width:1004px; height:38px;}
#menu li {float:left; height:38px;}
.notice {background: url(./images/menu_notice.png); height:38px; width:80px;}
.community {background: url(./images/menu_community.png); height:38px; width:78px;}
.webstudy {background: url(./images/menu_webstudy.png); height:38px; width:77px;}
.blog {background: url(./images/menu_blog.png); height:38px; width:59px;}

.notice a:hover {padding-top:-38px;}
</style>
<div id="menu">
<li><a href="#"><div class="notice"></div></a></li>
<li><a href="#"><div class="community"></div></a></li>
<li><a href="#"><div class="webstudy"></div></a></li>
<li><a href="#"><div class="blog"></div></a></li>
<li><img src="images/menu_bg.png" /></li>
</div>

첨부파일

menu_blog.png (2.2 KB)
0회 2009-12-15 22:23
|

댓글 5개

패딩이 아니라 백그라운드 이미지 좌표값을 변경해주시면 됩니다.
자세한건 아랫분이...ㅌㅌㅌ
이런식으로요?
background-position:0 -192px;
.community li a{background: url(./images/menu_community.png) top no-repeat}
.community li a:hover{background: url(./images/menu_community.png) bottom no-repeat}
그냥 자바스크립트로

<img src='menu1_off.gif' onmouseover="this.src='menu1_on.gif';" onmouseout="this.src='menu1_out.gif';"> 하는게 간단할거같은데요~
이미지를 배경으로 지정해서 padding, margin은 안 되고,
#menu a:hover div { background-position: left bottom; }
추가해 주세요.
IE7에서 확인했습니다.


그리고 css 메뉴는 다음을 참고 하세요.
http://www.alistapart.com/articles/slidingdoors/
댓글을 작성하시려면 로그인이 필요합니다.

그누4 질문답변

그누보드4 관련 질문은 QA 로 이전됩니다. QA 그누보드4 바로가기 기존 게시물은 열람만 가능합니다.

+
제목 글쓴이 날짜 조회
16년 전 조회 1,685
16년 전 조회 782
16년 전 조회 905
16년 전 조회 793
16년 전 조회 824
16년 전 조회 1,864
16년 전 조회 932
16년 전 조회 2,571
16년 전 조회 1,072
16년 전 조회 1,535
16년 전 조회 826
16년 전 조회 753
16년 전 조회 797
16년 전 조회 790
16년 전 조회 1,223
16년 전 조회 2,848
16년 전 조회 3,838
16년 전 조회 2,554
16년 전 조회 950
16년 전 조회 1,009