갤러리 게시판에 마우스 오버시 호버효과 줬는데요.

갤러리 게시판에 마우스 오버시 호버효과 줬는데요.

QA

갤러리 게시판에 마우스 오버시 호버효과 줬는데요.

본문

img {

    opacity: 1.0;

    filter: alpha(opacity=50); /* For IE8 and earlier */

}

 


img:hover {

    opacity: 0.8;

    filter: alpha(opacity=100); /* For IE8 and earlier */

}

 

 

 

 

 

<!DOCTYPE html>

<html>

<head>

<style>

img {

    opacity: 1.0;

    filter: alpha(opacity=50); /* For IE8 and earlier */

}

 


img:hover {

    opacity: 0.8;

    filter: alpha(opacity=100); /* For IE8 and earlier */

}

</style>

</head>

<body>

 


<h1>Image Transparency</h1>

<p>The opacity property is often used together with the :hover selector to change the opacity on mouse-over:</p>

<img src="img_forest.jpg" alt="Forest" width="170" height="100">

<img src="img_mountains.jpg" alt="Mountains" width="170" height="100">

<img src="img_fjords.jpg" alt="Fjords" width="170" height="100">

 


<p><b>Note:</b> In IE, a !DOCTYPE must be added for the :hover selector to work on other elements than the a element.</p>

 


</body>

</html>

 

 

 

갤러리 게시판에 리스트 이미지만 호버가 적용되야 하는데  본문에 이미지들 전부 호버가 적용되버리네요.

어디를 수정해야할까요..? ㅜㅜ

이 질문에 댓글 쓰기 :

답변 4

<!DOCTYPE html>

<html>

<head>

<style>

.group img {

    opacity: 1.0;

    filter: alpha(opacity=50); /* For IE8 and earlier */

}

 


.group img:hover {

    opacity: 0.8;

    filter: alpha(opacity=100); /* For IE8 and earlier */

}

</style>

</head>

<body>

 


<h1>Image Transparency</h1>

<p>The opacity property is often used together with the :hover selector to change the opacity on mouse-over:</p>

<div class="group">

<img src="img_forest.jpg" alt="Forest" width="170" height="100">

<img src="img_mountains.jpg" alt="Mountains" width="170" height="100">

<img src="img_fjords.jpg" alt="Fjords" width="170" height="100">

</div>

 


<p><b>Note:</b> In IE, a !DOCTYPE must be added for the :hover selector to work on other elements than the a element.</p>

 


</body>

</html>

이미지 테그에 다 호버 효과를 css로 주었으니 그렇지요 해당 id img 만 실행되도록 수정해 주셔야 합니다.

<style>

.group img:hover {opacity:0.8}

</style>

 

<div class="group">

  <img src="img.jpg">

</div>

 

위코드를 참고하세요

답변을 작성하시기 전에 로그인 해주세요.
전체 123,665 | RSS
QA 내용 검색

회원로그인

(주)에스아이알소프트 / 대표:홍석명 / (06211) 서울특별시 강남구 역삼동 707-34 한신인터밸리24 서관 1404호 / E-Mail: admin@sir.kr
사업자등록번호: 217-81-36347 / 통신판매업신고번호:2014-서울강남-02098호 / 개인정보보호책임자:김민섭(minsup@sir.kr)
© SIRSOFT