• 로그인
  • 장바구니에 상품이 없습니다.

home2 게시판 HTML/CSS 게시판 hover 로 애니매이션

hover 로 애니매이션

2 글 보임 - 1 에서 2 까지 (총 2 중에서)
  • 글쓴이
  • #89595

    최문길
    참가자
        <style>
            .shop-bg {
                background-color: #eee;
                padding: 20px;
            }
            .shop-container {
                display: flex;
                justify-content: space-between;
            }
            .item {
                position: relative;
                width: 33%;
                padding: 20px;
            }
            img {
                width: 100%;
                vertical-align: top;
            }
            .animation {
                position: relative;
                height: 100%;
                background-color: black;
                overflow: hidden;
            }
            .p {
                position: absolute;
                width: 100%;
                height: 50%;
                top: 100%;
                left: 0;
                background-color: #eee;
                transition: all .5s;
            }
            .animation:hover .p {
                top: 50%;
                transition: all .5s;
            }
        </style>
    </head>
    <body>
         <div class="shop-bg">
            <div class="shop-container">
                <div class="item">
                    <div class="animation">
                        <div class="p">
                        4
                        </div>
                    
                    < img src="../product1-1.jpg" alt="">
                </div>
                </div>
            
          
                <div class="item">
                    <div class="animation">
                        <div class="p">
                        4
                        </div>
                    
                    < img src="../product2.jpg" alt="">
                    </div>
                </div>
           
          
                <div class="item">
                    <div class="animation">
                       <div class="p">
                        4
                       </div>
                    
                    < img src="../product3.jpg" alt="">
                </div>
            </div>
            
        </div>
        
    </body>
    </html>
    

    <hr />

    선생님이 내주신 숙제는 끝냈습니다.
    그런데 궁금한 점이
    
            .animation:hover .p {
                top: 50%;
                transition: all .5s;
            } 
    
    이렇게 하여서 완성했는데
    animation이라는 박스를 호버 했을 때 그 안에 있는 p라는 클래스의 박스의 top 50%
    올려라는 뜻인데
    
    p라는 클래스에 마우스가 위치해 있는데도 hover를 통한 애니메이션이 유지되고
     있는지가 궁금합니다.
    
    참고: 개발자 도구로 확인 해봤는데 p라는 클래스의 박스에 마우스가 위치해 있는데도
    hover 애니메이션이 되니 계속 hover 애니메이션이 동작되는게 궁금합니다.
    참 쓸데 없는 궁금증 일 수 도 있는데 전 이런게 궁금하네요
    
    
    
    #89629

    codingapple
    키 마스터
    아마 자식 html 요소에 이벤트가 발생하면 부모 html 요소에도 버블링이 일어나서 그런듯요
    
    
2 글 보임 - 1 에서 2 까지 (총 2 중에서)
  • 답변은 로그인 후 가능합니다.

About

현재 월 700명 신규수강중입니다.

  (09:00~20:00) 빠른 상담은 카톡 플러스친구 코딩애플 (링크)
  admin@codingapple.com
  이용약관
ⓒ Codingapple, 강의 예제, 영상 복제 금지
top

© Codingapple, All rights reserved. 슈퍼로켓 에듀케이션 / 서울특별시 강동구 고덕로 19길 30 / 사업자등록번호 : 212-26-14752 온라인 교육학원업 / 통신판매업신고번호 : 제 2017-서울강동-0002 호 / 개인정보관리자 : 박종흠