• 카테고리

    질문 & 답변
  • 세부 분야

    자격증 (디자인)

  • 해결 여부

    해결됨

.btn span에서 border-bottom 없애는 부분이랑 네비게이션 질문있습니다.

21.08.07 20:42 작성 조회수 168

1

.btn span에서 밑에 보더를 없애려고 border-bottom: none;  background-color: #fff;  margin-bottom: -1px;은 줬는데

display: block; 으로 하면 밑에 보더가 안없어지고 inline-block으로 해야 없어지더라구요. 강의 영상에서는 block으로 해도 된다고 하셨는데... 어떤 차이가 있는 건가요..? 그냥 제가 css 입력을 잘못한걸까요...? css도 같이 첨부합니다.

(밑에 css에서는 span이 아니라 a태그로 되어있습니다.)

두번째로 네비게이션의 .li > a 부분에 마우스가 올라가면 서브메뉴가 나와야 하는데 서브메뉴가 내려오는 부분에만 마우스가 올라가도 바로 내려와버립니다. 뭐가 문제인지 모르겠어요... 사진 첨부합니다..

@charset "utf-8";

/*background*/

body {

    background-color: #ffffff;

    color: #222328;

    margin: 0;

    font-size: 15px;

}

a {

    text-decoration: none;

    color: #000;

}

/*inner-set*/

.container {}

.header-inner {

    background-color: #ddd;

}

.content-inner {}

.footer-inner {

    background-color: #ddd;

    overflow: hidden;

}

/*header*/

header {

    width: 1200px;

    margin: auto;

    height: 100px;

    position: relative;

}

header > div {

    height: 100px;

}

.header-logo {

    width: 200px;

    float: left;

    line-height: 130px;

}

/*navigation*/

.navi {

    width: 600px;

    float: right;

}

.menu {

    list-style: none;

    padding: 0;

    margin-top: 68px;

}

.menu li {

    float: left;

    width: 25%;

    text-align: center;

    height: 180px;

    box-sizing: border-box;

}

.menu li > a {

    border: 1px solid black;

    padding: 5px;

    display: block;

    transition: 0.5s;

}

.menu li:hover > a {

    background-color: black;

    color: white;

}

.sub-menu {

    border: 1px solid black;

    display: none;

}

.sub-menu a {

    color: white;

    display: block;

    padding: 5px;

    transition: 0.5s;

}

.sub-menu a:hover {

    background-color: white;

    color: black;

}

.sub-back {

    background-color: black;

    width: 100%;

    height: 170px;

    position: absolute;

    right: 0;

    top: 100%;

    z-index: -1;

    display: none;

}

/*slide*/

.slide {

    width: 1200px;

    margin: auto;

    height: 300px;

    position: relative;

    overflow: hidden;

    z-index: -2;

}

.slide div {

/*    height: 300px;*/

    width: 3600px;

    font-size: 0;

    position: absolute;

    animation: slide 10s linear infinite;

    top: 0;

    left: 0;

}

@keyframes slide {

    0% {left: 0;}

    30% {left: 0;}

    35% {left: -1200px;}

    65% {left: -1200px;}

    70% {left: -2400px;}

    95% {left: -2400px;}

    100% {left: 0;}

}

/*items*/

.items {

    width: 1200px;

    margin: auto;

    overflow: hidden;

}

.items > div {

    box-sizing: border-box;

    height: 200px;

    float: left;

}

/*news*/

.news, .gallery {

    width: 430px;

    padding: 10px;

}

.btn {}

.btn a {

    border: 1px solid black;

    display: inline-block;

    width: 100px;

    padding: 5px;

    text-align: center;

    border-radius: 5px 5px 0 0;

    border-bottom: none;

    background-color: #fff;

    margin-bottom: -1px;

}

.tab1, .tab2 {

    border: 1px solid black;

    border-radius: 0 5px 5px 5px;

    padding: 5px;

    padding-top: 5px;

    height: 135px;

    background-color: white;

    

}

.tab1 a {

    display: block;

    padding: 3px;

    border-bottom: 1px solid black;

}

.tab1 a:last-child {

    border-bottom: none;

}

.tab1 a em {

    font-style: normal;

}

.tab1 a b {

    font-weight: normal;

    float: right;

}

.tab2 {

    text-align: center;

}

.tab2 img {

    padding-top: 8px;

    width: 120px;

}

/*banner*/

.banner {

    width: 340px;

    padding: 10px;

}

.banner img {

    width: 100%;

}

/*footer*/

footer {

    width: 1200px;

    margin: auto;

    overflow: hidden;

}

footer > div {

    height: 100px;

}

.footer-menu {

    float: left;

}

.footer-menu > div {

    height: 50px;

    width: 1000px;

    text-align: center;

    box-sizing: border-box;

}

.bottom-menu {

    line-height: 50px;    

}

.copyright {

    line-height: 20px;    

    

}

.family-site {

    float: right;

    width: 200px;

}

/*modal*/

.modal {

    background-color: rgba(0, 0, 0, 0.2);

    width: 100%;

    height: 100%;

    position: absolute;

    top: 0;

    left: 0;

    display: none;

}

.modal-content {

    position: absolute;

    top: 50%;

    left: 50%;

    transform: translate(-50%, -50%);

    background-color: white;

    border-radius: 10px;

    padding: 30px;

    width: 400px;

    height: 450px;

}

.modal h2 {

    text-align: center;

}

.modal p {

    padding: 10px;

    margin-top: 30px;

}

.close-modal {

    float: right;

    background-color: black;

    color: white;

    padding: 7px;

    border-radius: 5px;

    margin: 10px;

    margin-top: 20px;

    cursor: pointer;

}

제이쿼리

$('.menu li').mouseenter(function(){

    $('.sub-menu, .sub-back').stop().slideDown()

})

$('.menu li').mouseleave(function(){

    $('.sub-menu, .sub-back').stop().slideUp()

})

답변 2

·

답변을 작성해보세요.

0

아래 내용을 보시면 아시겠지만 .sub-menu에 높이값을 줄 필요는 없습니다. 

seohyeon님의 프로필

seohyeon

질문자

2021.08.08

감사합니다!! :)

0

html 코드도 올려주셔야지 제가 확인 가능해요.

html 코드 답글로 올려주세요~

seohyeon님의 프로필

seohyeon

질문자

2021.08.08

여기요!!

<!DOCTYPE html>

<html lang="ko">

<head>

    <meta charset="UTF-8">

    <title>practice - B04</title>

    <link rel="stylesheet" href="css/new.css">

</head>

<body>

  

    <div class="container">

        <div class="header-inner">

            <header>

                <div class="header-logo">

                    <a href="#none"><img src="images/logo-header.png" alt="header-logo"></a>

                </div>

                <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>

                        </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>

                        </li>

                        <li>

                            <a href="#none">정보서비스</a>

                            <div class="sub-menu">

                                <a href="#none">대학정보알림</a>

                                <a href="#none">정보공개</a>

                                <a href="#none">정보서비스안내</a>

                            </div>

                        </li>

                        <li>

                            <a href="#none">커뮤니티</a>

                            <div class="sub-menu">

                                <a href="#none">공지사항</a>

                                <a href="#none">참여게시판</a>

                                <a href="#none">자료실</a>

                            </div>

                        </li>

                    </ul>

                    <div class="sub-back"></div>

                </div>

            </header>

        </div>

        <div class="content-inner">

            <div class="slide">

                <div>

                    <a href="#none"><img src="images/slide-01.jpg" alt="slide-01"></a>

                    <a href="#none"><img src="images/slide-02.jpg" alt="slide-02"></a>

                    <a href="#none"><img src="images/slide-03.jpg" alt="slide-03"></a>

                </div>

            </div>

            <div class="items">

                <div class="news">

                    <div class="tab-inner">

                        <div class="btn">

                            <a href="#none">공지사항</a>

                        </div>

                        <div class="tab1">

                            <a href="#none"><em>산업대학교 동문회장배 자선골프대회</em> <b>2016-09-12</b></a>

                            <a href="#none"><em>개교 100주년 기념 야외 오페라 초청</em> <b>2016-09-10</b></a>

                            <a href="#none"><em>동문회장 및 운영위원장 후보자 추천</em> <b>2016-09-09</b></a>

                            <a href="#none"><em>진행위원회(정회원) 선발 결과</em> <b>2016-09-07</b></a>

                            <a href="#none"><em>산업대학교 동문회 개최일 변경</em> <b>2016-08-30</b></a>

                        </div>

                    </div>

                </div>

                <div class="gallery">

                    <div class="tab-inner">

                        <div class="btn">

                            <a href="#none">갤러리</a>

                        </div>

                        <div class="tab2">

                            <a href="#none"><img src="images/gallery-01.jpg" alt="gallery-01"></a>

                            <a href="#none"><img src="images/gallery-02.jpg" alt="gallery-02"></a>

                            <a href="#none"><img src="images/gallery-03.jpg" alt="gallery-03"></a>

                        </div>

                    </div>

                </div>

                <div class="banner">

                    <a href="#none"><img src="images/banner.jpg" alt="banner"></a>

                </div>

            </div>

        </div>

        <div class="footer-inner">

            <footer>

                <div class="footer-menu">

                    <div class="bottom-menu">

                        <a href="#none">법적고지</a>

                        <a href="#none">개인정보취급방침</a>

                        <a href="#none">

                        개인정보처리방침</a>

                    </div>

                    <div class="copyright">

                        상호명 : 산업대학교

                        대표자 : 송성훈

                        개인정보관리책임자 : 김보미 대리 <br>

                        사업장주소 : 서울특별시 중구 개항로 49

                    </div>

                </div>

                <div class="family-site">

                    <select>

                        <option value="">family site</option>

                        <option value="">산업대학교</option>

                        <option value="">정보통신부</option>

                        <option value="">

                            과학기술연구원

                        </option>

                    </select>

                </div>

            </footer>

        </div>

    </div>  

    <div class="modal">

        <div class="modal-content">

            <h2>2020년도 장기인턴십 참가학생 모집</h2>

            <p>

                산업대학교 2020년도 장기인턴십 참가학생 모집에 참가할 학생을 모집하오니 많은 관심있는 학생들의 지원 부탁드립니다. <br>

                재학생 최종선발학생은 2020학년도 1학기 코업, 코업프로젝트 교과목을 반드시 수강해야 합니다. 졸업학점 6학점 인정되며 매칭기간으로 전화문의가 많아 통화가 어려우니 문의는 가급적 이메일로 부탁드립니다. <br><br>

                참고사항으로  2020학년도 1학기 교과목 수강신청이 불가한 졸업자, 2020년 2월 졸업 예정자 및 수료자는 지원 불가합니다. 착오 없으시길 바랍니다. <br><br>

                자세한 문의사항은 현장실습지원센터 홈페이지를 참고해주세요.

            </p>

            <div class="close-modal">X 닫기</div>

        </div>

    </div>

   

    <script src="script/jquery-1.12.4.js"></script>

    <script src="script/custom.js"></script>

    

</body>

</html>