图像在div中重叠

时间:2016-10-13 03:42:46

标签: html css html5 css3

这是我的HTML

<header>
    <div class="top_nav">
    <div class="logo">
        <a id="site-logo" href="#"><img src="#" alt="LOGO"></a>
        </div>
        <div class="contact_details">
            <p>Call: 1234454 |<a href="#"> Mail</a></p>
        </div>
        <div class="nav_bar">
            <ul>
                <li><a href="#">Services</a></li>
                <li><a href="#">Solution</a></li>
                <li><a href="#">Support</a></li>
                <li><a href="#">Partners</a></li>
                <li><a href="#">Contacts</a></li>
            </ul>
        </div>
    </div>
</header>
    <div class="container">
    <img src="img/cover.jpg">
    </div>
</body>

这是css

*{
    margin: 0;
    padding: 0;
}
/* Header Starts Here */
.top_nav{
    height: 80px;
    width: 100%;
    background-color: #000400;
    position: relative;
}

.top_nav .logo{
    margin-top: 2px;
    margin-left: 20px;
    height: 75px;
    width: 200px;
    float: left;
    position: absolute;
}

.contact_details{
    margin-top: 5px;
    margin-left: 1115px;
    min-height: 25px;
    min-width: 230px;
    float: right;
    color: #fff;
    position: absolute;
}

.contact_details p{
    font-size: 14px;
    text-align: center;
}

.contact_details p a{
    text-decoration: none;
    color: #fff;
}

.nav_bar{
    margin-left: 700px;
    margin-top: 45px;
    position: absolute;
}

.nav_bar ul{
    list-style-type: none;
}

.nav_bar ul li{
    display: inline-block;
    text-align: center;
    float: left;
}

.nav_bar ul li a{
    text-decoration: none;
    padding: 12px;
    margin: 8px;
    font-size: 20px;
    color: #fff;
    position: relative;
}

.nav_bar ul li a::after{
    content: '';
    display: inline-block;
    position:absolute;
    width: 0px;
    height: 4px;
    bottom: 0;
    left: 0;
    right: 0;
    margin: auto;
    background: #ff6600;
    transition: width .4s;
}

.nav_bar ul li a:hover::after{
    content: '';
    display: inline-block;
    position:absolute;
    width: 0px;
    height: 4px;
    bottom: 0;
    left: 0;
    right: 0;
    margin: auto;
    background: #ff6600;
    width: 100%;
}

/* Header End Here */

#container{
    height: 600px;
    width: 100%;
}

我的图像是从div(容器)重叠,我希望这个div从页面顶部开始,我将透明我的菜单栏还有一件事,我应该使用div中的图像标签添加图像或直接添加div标签中的图像使用css

0 个答案:

没有答案