인프런 커뮤니티 질문&답변

My own life님의 프로필 이미지
My own life

작성한 질문수

[2024년 출제기준] 웹디자인기능사 실기시험 완벽 가이드(HTML+CSS+JQUERY)

[최종본 제작] 세로 2컬럼(C2타입) – Part2

.menu나 .sub-menu에 hover하면 검정색배경에 흰색글씨로 바뀌어야 하는데 안되네요 코드에 어떤 문제가 있나요?

해결된 질문

작성

·

471

1

.menu나 .sub-menu에 hover하면 검정색배경에 흰색글씨로 바뀌어야 하는데 안되네요 코드에 어떤 문제가 있나요?

<!DOCTYPE html>
<html lang="ko">
<head>
    <meta charset="UTF-8">
    <title>부여 가을연꽃축제</title>
    <link rel="stylesheet" href="css/style.css">
</head>
<body>
    <div class="container">
         <div class="left">
              <header>
                  <div class="header-logo">
                       <a href="#none">
                            <img src="images/logo-header.png" alt="header-logo">
                       </a>
                  </div><!--.header-logo-->
                  <div class="navi">
                       <ul class="menu">
                            <li>
                                 <a href="#none">축제소개</a>
                                   <div class="sub-menu">
                                        <a href="#none">초대의 글</a>
                                        <a href="#none">축제개요</a>
                                        <a href="#none">축제연혁</a>
                                        <a href="#none">오시는길</a>
                                   </div><!--.sub-menu-->
                            </li>
                            <li>
                              <a href="#none">행사안내</a>
                                   <div class="sub-menu">
                                        <a href="#none">셔틀버스안내</a>
                                        <a href="#none">행사안내</a>
                                        <a href="#none">행사일정</a>
                                        <a href="#none">소공연장</a>
                                   </div><!--.sub-menu-->
                            </li>
                            <li>
                              <a href="#none">홍보마당</a>
                                   <div class="sub-menu">
                                        <a href="#none">축제소식</a>
                                        <a href="#none">보도자료</a>
                                        <a href="#none">음식레시피</a>
                                     
                                   </div><!--.sub-menu-->
                            </li>
                            <li>
                              <a href="#none">참여마당</a>
                                   <div class="sub-menu">
                                        <a href="#none">참가후기</a>
                                        <a href="#none">연꽃갤러리</a>
                                        <a href="#none">포토갤러리</a>
                                   </div><!--.sub-menu-->
                            </li>
                       </ul>
                  </div><!--.navi-->
              </header>
         </div><!--.left-->
         <div class="right">
              <div class="slide">
                   <div>
                        <a href="#none">
                             <img src="images/slide-01.jpg" alt="slide image1">
                        </a>
                        <a href="#none">
                         <img src="images/slide-02.jpg" alt="slide image2">
                        </a>
                        <a href="#none">
                              <img src="images/slide-03.jpg" alt="slide image3">
                        </a>
                   </div>
              </div><!--.slide-->
              <div class="items">
                   <div class="news"></div><!--.news-->
                   <div class="gallery"></div><!--.gallery-->
                   <div class="shortcut"></div><!--.shortcut-->
              </div><!--.items-->
              <footer>
                <div class="copyright">
                    (주)이스타컴퍼니 | 대표자 : 최종윤 | 개인정보관리책임자 : 이주현 부장
                    사업장주소 : 인천광역시 중구 개항로 6층 (주)이스타컴퍼니
                </div><!--.copyright-->
                <div class="sns">
                     <div>
                         <a href="#none">
                              <img src="images/sns-01.png" alt="facebook">
                         </a>
                         <a href="#none">
                              <img src="images/sns-02.png" alt="tweeter">
                         </a>
                         <a href="#none">
                              <img src="images/sns-03.png" alt="instagram">
                         </a> 
                     </div>
                     <div>
                         <select>
                              <option value="">
                                   Family Site
                              </option>
                              <option value="">
                                   여주군청 홈페이지
                              </option>
                              <option value="">
                                   한국관광공사
                              </option>
                              <option value="">
                                   여행자보험가입
                              </option>
                         </select>
                     </div>
                     
                </div><!--.sns-->
              </footer>
         </div><!--.right-->
    </div>
    <script src="script/jquery-1.12.4.js"></script>
    <script src="script/custom.js"></script>
    
</body>
</html>
@charset 'utf-8';
*{
    padding0;
    list-stylenone;
    text-decorationnone;
}
a{
    color:#222328;
}
body{
    margin:0;
    background-color#fff;
    color:#222328;
    font-size15px;
}
.container{
   border1px solid red;
   width:1000px;
  
}
.container > div{
    
    floatleft;
    box-sizingborder-box
}
.left{
    width:200px;
}
.right{
    width:800px;
}
header{
     
}
header > div{}
.header-logo{
    height100px;
    line-height130px;
}
.navi{
    height400px;
}

.slide > div{
    border1px solid green;
    height350px;
}

.items{
    overflowhidden;
}
.items > div{
    border1px solid pink;
    height200px;
    floatleft;
    box-sizingborder-box;
}
.news{
    width300px;
}
.gallery{
    width300px;
}
.shortcut{
    width200px;
}

footer{
    overflowhidden;
}
footer > div{
    height100px;
    float:left;
    box-sizingborder-box;
    text-aligncenter;
}
.copyright{
   width:600px;
   padding-top30px;
}
.sns{
    width:200px;
}
.sns div{
    height50px;
    box-sizingborder-box;
    }
.sns div:nth-child(1){
    padding-top15px;
}    
.sns div:nth-child(2){
    padding-top10px;
}

/* slide */
.slide{
    positionrelative;
}
.slide > div{
    /*position: absolute;를 여기에다가 주는게 아니라 .slide > div a{}안에 주어야함*/
}
.slide > div a{
    positionabsolute;
    top:0;
    left:0;
    opacity0;
    animation: slide 10s linear infinite;
}
.slide > div a:nth-child(1){
    animation-delay0s;
}
.slide > div a:nth-child(2){
    animation-delay3.5s;
}
.slide > div a:nth-child(3){
    animation-delay7s;
}
@keyframes slide{
    0%{
        opacity0;
        visibilityhidden;
        /*visibility: hidden;*/
    }
    5%{
        opacity1
    }
    35%{
        opacity1;  
    }
    40%{
        opacity0;  
    }
    100%{
        opacity0;
    }
}

/* Nevigation */
.menu{
   padding0;
   width90%;
   marginauto;
}
.menu li{
    text-aligncenter;
}
.menu li > a{
    border1px solid #000;
    displayblock;
    padding5px;
    transition0.5s;
}
.menu li:hover > a{
    background-color#fff;
    color:#000;
}
.sub-menu{
    border1px solid #000;
}
.sub-menu a{
    displayblock;
    padding5px;
    transition0.5s;
}
.sub-menu a:hover{
    background-color#fff;
    color:#000;
}

답변 1

1

아래 질문글과 같은 글인데 중복으로 올리셨네요.

아래 글에 답변 보시면 해결되실거에요~

My own life님의 프로필 이미지
My own life
질문자

감사합니다

My own life님의 프로필 이미지
My own life

작성한 질문수

질문하기