当我调整屏幕大小时,为什么我的div会不断重叠?

时间:2015-02-09 04:17:25

标签: html css

我已经做了一些搜索,我似乎无法找出错误的原因。我的主要内容与横幅重叠。我尝试使用隐藏和自动隐藏的位置和溢出,但我似乎仍然无法做到正确。

这里是html

<html>
  <head>
      <title> Website </title>
      <link rel="stylesheet" type="text/css" href="style.css">
  </head>
  <body>
    <p>
        <div id="Navigation Container"></div>
        <div id="header">
            <a href="index.html"><img src="nav bar logo.png"></a>
        </div>

        <div id='Navigation'>
            <ul>
                <li><a href="#"><font color="#FFFFFF">Contact</font></a></li>
                <li><a href="#"><font color="#FFFFFF">About</font></a></li>
            </ul>
        </div>

        </div></div>

        <div id="Banner">
            <div id="wrapper">
                <div id="container">
                    <img class="banner-img" src="../Banner.png">
                </div>
            </div>
        </div>

        <div id="MainContent">
            <p>
                <font color="#000000">
                    <h1><font face="Palatino Linotype" color="#5DA05D" size="6">Header</font></h1>
                    <font face="Verdana" size="3">
                        <p>Just some text...</p>
                        <p>That keeps overlapping...</p>
                    </font>
                </font>
            </p>
        </div>

        <div id="footer"></div>
    </p>
</body>

这里是CSS:

body {
    background: #F9F9F9; margin: 0 auto; padding: 0; font: color: #FFFFFF; text-align: center} 
a {
    color: #2b2bf6;}

#header { 
    float: left; 
    position: fixed;
    Align: left;
    clear: both;
    width: 0x; 
    max-width: 100%;    
    height: 70px;   
    margin: 0; 
    padding: 0; 
    border: 0; 
    background: 
    #FFFFFF; 
    z-index: 2;}



#Navigation {  
    width: 100%;
    height: 70px; 
    margin: 0; 
    padding: 0; 
    background: #000000;
    Font-size: 18px;
    float: right;
    position: fixed;
    z-index: 1;
    display: incline-block;
    }

#Navigation Container {
    WIDTH: 100%;
    float: right; 
    background: #282828;
    position: fixed;
    z-index: 0;}

#Banner {
    height: 100%;
    width: 100%;
    margin: auto;
    padding-top: 70px}

#wrapper {
    width: 100%;
    overflow: hidden; }

#container {
    width: 100%;
    margin: 0 auto; }

#banner-img {
    width: 100%;}


#dropdown {
    position: relative; 
    overflow: hidden; }

#MainContent {
    margin-top: -270px; 
    margin-left: 20%;
    margin-right: 20%;
    margin-bottom: 100px;
    text-align: left;}

#footer {
    width: 100%;
    height: 120px;
    background: #282828;
    padding: 0px; } 



#navwrap {
    width: 160px;
    height: 70px;
    Float: right;
    display: incline-block;
    z-index: 4; }

#Searchbar {
    float: left;
    padding: 20px;
    }



ul{
        padding: 0;
        list-style: none;
    height: 70px;

    }
ul li{
        float: right;
        width: 110px;
        text-align: center;
        line-height: 21px;
    }
ul li a{
    display: block;
    height: px;
        padding: 5px 10px;
        color: #333;
        background: #282828;
        text-decoration: none;
    }
ul li a:hover{
        color: #fff;
        background: #3d3d3d;
    }
ul li ul{
        display: none;
    }
ul li:hover ul{
        display: block; 
    }

请帮忙。

1 个答案:

答案 0 :(得分:1)

您发布的HTML中存在一些差异。 我纠正了同样的问题。你可以重复使用HTML并检查。

<html>
  <head>
      <title> Website </title>
      <link rel="stylesheet" type="text/css" href="style.css">
  </head>
  <body>
    <p>
        <div id="Navigation Container"></div>
        <div id="header">
            <a href="index.html"><img src="nav bar logo.png"></a>
        </div>

        <div id='Navigation'>
            <ul>
                <li><a href="#"><font color="#FFFFFF">Contact</font></a></li>
                <li><a href="#"><font color="#FFFFFF">About</font></a></li>
            </ul>
        </div>
        <div id="Banner">
            <div id="wrapper">
                <div id="container">
                    <img class="banner-img" src="../Banner.png">
                </div>
            </div>
        </div>
        <div id="MainContent">
            <p>
                <font color="#000000">
                    <h1><font face="Palatino Linotype" color="#5DA05D" size="6">Header</font></h1>
                    <font face="Verdana" size="3">
                        <p>Just some text...</p>
                        <p>That keeps overlapping...</p>
                    </font>
                </font>
            </p>
        </div>
        <div id="footer">
        </div>
    </p>
</body>
</html>