выпадающее меню не отображается после предоставления изображения под строкой меню - PullRequest
0 голосов
/ 27 апреля 2020

Может кто-нибудь сказать мне, как я могу исправить выпадающее меню? после ввода курсора выпадающие элементы не отображаются, если я помещаю изображение в другой раздел, но раскрывающийся список отображается, если я не помещаю изображение. Но мне нужно поставить изображение. пожалуйста, скажите мне, что я сделал не так.

вот мой HTML код =

<html>
    <head>

        <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />


        <link rel="stylesheet" href="style.css" type="text/css"/>


    </head>

    <body>

            <header>



            <div class="menu-bar">

                <nav>

                    <ul>

                        <li><a href="index.html"><i class="fa fa-home"></i><span class="data-hover"data-hover="home">&nbsp;Home</span></a></li>

                        <li><a href="#"><span class="data-hover" data-hover="Shortcodes"><i class="fa fa-file-text-o"></i>&nbsp;About</span></a>

                            <ul>

                                <li><a href="#">D1</a></li>

                                <li><a href="#">D2</a></li>


                            </ul>

                        </li>

                        <li><a href="#" ><span class="data-hover" data-hover="pages"><i class="fa fa-briefcase" aria-hidden="true"></i>&nbsp;Our work</span></a>

                            <ul>

                                <li><a href="#">D3</a></li>

                                <li><a href="#">D4/a></li>

                            </ul>

                        </li>

                        <li><a href="#"><span class="data-hover" data-hover="Portfolio"><i class="fa fa-users" aria-hidden="true"></i>&nbsp;Galary</span></a>

                            <ul>

                                <li><a href="#">D5</a></li>

                                <li><a href="#">D6</a></li>


                            </ul>

                        </li>

                        <li><a href="#"> <span class="data-hover" data-hover="contact"><i class="fa fa-phone" aria-hidden="true"></i>&nbsp;Contact</span></a></li>


                    </ul>

                </nav>

            </div>


        </header>

        <section>

            <div class="page_head">

                    <div class="contained">


                                <h1>XXXXXXXX</h1>


                    </div>

                 </div> 


        </section> </body> </html>

а вот CSS код

.menu-bar{
    background: #2c97e4;
    }

nav{
    height: 40px;
    width: 960px;
    display: block;
    margin-left: 250px;

}

nav li a{
    display: block;
    text-decoration: none;
    font-size: 16px;
    font-weight: bold;
    color:white;
    text-align: center;
    text-transform: capitalize;
    overflow: visible; 
}

nav a:hover{
    background: red;
    color:white;
    text-decoration: none;
}
nav ul{
    list-style: none;

}

nav ul li{
    float: left;
    width: 150px;
    height: 40px;
    line-height: 40px;
    background: #2c97e4;
    overflow-y: visible;
    margin-right: 30px;

}

nav ul li ul li{
    position: relative;
    display: none;
    right:50px;
}

nav ul li:hover ul li{
    display: block;
    width: 200px;
    padding:1px;
    position: relative;
    animation: nacm 500ms forwards;
} 

@keyframes nacm{
    0%{
        opacity: 0;
        top:5px;

    }

    100%{
        opacity: 1;
        top:0;
    }
}
.contained{
    width:90%;
    margin:auto;
    overflow:hidden;

}

.page_head{
    background: url(c-1.jpg);
    background-size:cover;
    background-position:center;
    height:100%;
    width:100%;
    padding-bottom:2%;
    position:relative;
    z-index:99;
    padding-top:110px;
    padding-bottom:82px;
}

.page_head .contained h1{
    font-size:50px;
    color:#FF4500;
    float: left;
    text-decoration: none;
    text-underline-position:under;
    text-decoration-color: #FF4500; 
    letter-spacing:3px;
}

1 Ответ

0 голосов
/ 28 апреля 2020

Эта работа для меня:

        .menu-bar {
            background: #2c97e4;
        }
        nav {
            height: 40px;
            width: 960px;
            display: block;
            margin-left: 250px;
        }           
        nav li a {
            display: block;
            text-decoration: none;
            font-size: 16px;
            font-weight: bold;
            color: white;
            text-align: center;
            text-transform: capitalize;
            overflow: visible;
        }         
        nav a:hover {
            background: red;
            color: white;
            text-decoration: none;
        }  
        nav ul {
            list-style: none;
        }
        nav ul li {
            float: left;
            width: 150px;
            height: 40px;
            line-height: 40px;
            background: #2c97e4;
            overflow-y: visible;
            margin-right: 30px;
        }
        nav ul li ul li {
            position: relative;
            display: none;
            right: 50px;
        }
        nav ul li:hover ul li {
            display: block;
            width: 200px;
            padding: 1px;
            position: relative;
            animation: nacm 500ms forwards;
        }
        @keyframes nacm {
            0% {
                opacity: 0;
                top: 5px;
            }
            100% {
                opacity: 1;
                top: 0;
            }
        }
        .contained {
            width: 90%;
            margin: auto;
            overflow: hidden;
        }
        .page_head {
            background: url(c-1.jpg);
            background-attachment: fixed;
            height: 690px;
            background-size: cover;
            background-position: center;
            width: 100%;
            padding-bottom: 2%;
            position: relative;
            z-index: -1;
            padding-top: 110px;
            padding-bottom: 82px;
        }
        .page_head .contained h1 {
            font-size: 50px;
            color: #FF4500;
            float: left;
            text-decoration: none;
            text-underline-position: under;
            text-decoration-color: #FF4500;
            letter-spacing: 3px;
        }
<html>
<head>
    <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
</head>
<body>
    <header>
        <div class="menu-bar">
            <nav>
                <ul>
                    <li><a href="index.html"><i class="fa fa-home"></i><span class="data-hover"data-hover="home">&nbsp;Home</span></a></li>
                    <li><a href="#"><span class="data-hover" data-hover="Shortcodes"><i class="fa fa-file-text-o"></i>&nbsp;About</span></a>
                        <ul>
                            <li><a href="#">D1</a></li>
                            <li><a href="#">D2</a></li>
                        </ul>
                    </li>
                    <li><a href="#"><span class="data-hover" data-hover="pages"><i class="fa fa-briefcase" aria-hidden="true"></i>&nbsp;Our work</span></a>
                        <ul>
                            <li><a href="#">D3</a></li>
                            <li><a href="#">D4</a></li>
                        </ul>
                    </li>
                    <li><a href="#"><span class="data-hover" data-hover="Portfolio"><i class="fa fa-users" aria-hidden="true"></i>&nbsp;Galary</span></a>
                        <ul>
                            <li><a href="#">D5</a></li>
                            <li><a href="#">D6</a></li>
                        </ul>
                    </li>
                    <li>
                        <a href="#"> <span class="data-hover" data-hover="contact"><i class="fa fa-phone" aria-hidden="true"></i>&nbsp;Contact</span></a>
                    </li>
                </ul>
            </nav>
        </div>
    </header>
    <section>
        <div class="page_head">
            <div class="contained">
                <h1>XXXXXXXX</h1>
            </div>
        </div>
    </section>
</body>
</html>
Добро пожаловать на сайт PullRequest, где вы можете задавать вопросы и получать ответы от других членов сообщества.
...