html - 为什么我的 HTML 页面底部在我的内容下方有很大空间?

标签 html css height

在我的 CSS 中,我的内容下方的页面底部有一个很大的空白区域。据我所知,没有任何内容高到可以下降那么远。它不会发生在我正在制作的网站上的任何其他页面上。

HTML

<body>
<div id="wrapper">  

    <div id="header">
        <a href="index.html"><div id="leftHeader">
        <img src="assets/logo2.jpg" alt="Logo" style="width:65px;height:65px">
        <h1>Amanda Farrington</h1>
    </div>
        <div id="nav">

      <ul>
        <li><a href="about.html">About</a></li>
        <li><a href="#workJump">Work</a></li>
        <li><a href="contact.html">Contact</a></li>
        <li><a href="notes.html">Notes</a></li>
      </ul>
        </div>
    </div>



    <div id="hero">
        <div id="heroImage">
        <img src="assets/trees.jpg" alt="trees" style="width:100%;height:10%">
        </div>

        <div id="overlay">
        <h2>Amanda Farrington</h2>
        <h3>Graphic Artist | Web Designer</h3>
    <a href="assets/resume.pdf" class="down">View Resume</a>                


        </div>
    </div>


<a name="workJump"></a>

    <div id="work">
        <div id="label">
        <h4>Work</h4>
        </div>
    <div id="leftColumn">

        <div id= "p2article">
      <a href="work1.html">
        <img src="assets/work1p.jpg" alt="work one" style="width:100%;height:100%">
        <div id= "articleinfo2">
        <div id= "articleText2">
        <span class="title3">Cut Paper Portrait</span>
        </div>
        </div>
        </div>

        <div id= "p2article">
      <a href="work3.html">
        <img src="assets/work3p.jpg" alt="Work 3" style="width:100%;height:100%">
        <div id= "articleinfo2">
        <div id= "articleText2">
        <span class="title3">3D Christmas Eve Scene</span>
        </div>
        </div>
        </div>

        <div id= "p2article">
      <a href="work5.html">
        <img src="assets/work5p.jpg" alt="work 5" style="width:100%;height:100%">
        <div id= "articleinfo2">
        <div id= "articleText2">
        <span class="title3">3D Clock Ad</span>
        </div>
        </div>
        </div>

                <div id= "p2article">
            <a href="work7.html">
        <img src="assets/work7p.jpg" alt="work 7" style="width:100%;height:100%">
        <div id= "articleinfo2">
        <div id= "articleText2">
        <span class="title3">RIT Event Calendar Redesign</span>
        </div>
        </div>
        </div>

    </div>

    <div id="rightColumn">
        <div id= "p2article2">
      <a href="work2.html">
        <img src="assets/work2p.jpg" alt="work two" style="width:100%;height:100%">
        <div id= "articleinfo2">
        <div id= "articleText2">
        <span class="title3">Charcoal Self-Portrait</span>
        </div>
        </div>
        </div>

        <div id= "p2article2">
        <a href="work4.html">
        <img src="assets/work4p.jpg" alt="Work 4" style="width:100%;height:100%">
        <div id= "articleinfo2">
        <div id= "articleText2">
        <span class="title3">VH1 3D Bumper Animation</span>
        </div>
        </div>
        </div>

                <div id= "p2article2">
              <a href="work6.html">
        <img src="assets/work6p.jpg" alt="work 6" style="width:100%;height:100%">
        <div id= "articleinfo2">
        <div id= "articleText2">
        <span class="title3">Beauty Is</span>
        </div>
        </div>
        </div>

                <div id= "p2article2">
              <a href="work8.html">
        <img src="assets/work8p.jpg" alt="work 8" style="width:100%;height:100%">
        <div id= "articleinfo2">
        <div id= "articleText2">
        <span class="title3">Reporter Site Redesign</span>
        </div>
        </div>
        </div>
    </div>




    </div>
</div>
</body>
</html>

CSS

body {
  margin: 0px;
  padding: 0px;
  background: white;

}

/*----------header styles-------------*/
#header {
  color: #D7DADB;
  font-family: 'Roboto', sans-serif;
  font-weight: 300;
  font-size : 15px;
  text-align: left;
  width: 100%;
  padding-left: 3em;
  position: relative;
  height: 15%;
  box-sizing: border-box;
  padding-top: 1em;

}
h1:hover
{
color: #2C3E50;
}


#header img
{
    float: left;
    padding-left: 3em;
}

h1{
width: 9em;
float: left;
padding-left: 0.5em;
color: #45CCCC;
padding-bottom: 1px;
}

#nav {
  width: 50%;
  margin:0;
  padding:0;
  text-align: right;
  color: red;
  font-size:20px;
  float: right;
  padding-right: 2em;
  z-index: 98;
  position: relative;

}

#nav ul {
  padding: 1px;
}

#nav li {
  display: inline;
  padding: 38px;
}

#nav li a {
  color: #2C3E50;
  text-decoration: none;
}

#nav li a:hover {
  color: #45CCCC;
}

/*----------hero image styles-------------*/
#hero{
    padding-top: 25em;
    width: 100%;
    height: 30em;
    position: relative;
    z-index: 0;
}

#heroImage
{
    top: 9%;
    width: 100%;
    z-index: 1;
    position: absolute;

}

#overlay{
    width: 34em;
    top: -15%;
    margin-left: 30%;
    z-index: 2;
    position: relative;
    clear: left;


}

h2{
    width: 100%;
    position: relative;
    font-family: 'Roboto', sans-serif;
    font-weight: 300;
    font-size: 60px;
    float: center;
    color: white;
    opacity: 1.0;
    text-shadow: 2px 2px 3px #000000;
    text-align: center;
}

h3{
    width: 100%;
    position: relative;
    font-family: 'Roboto', sans-serif;
    font-weight: 300;
    font-size: 30px;
    color: #e5e5e5;
    opacity: 1.0;
    text-shadow: 2px 3px 2px #000000;
    text-align: center;

}

a.down{
    z-index: 99;
    font-family: 'Roboto', sans-serif;
    font-weight: 400;
    text-decoration: none;
    color: #181b1e;
    background: #45CCCC;
    position: relative;
    padding: 0.6em 0.2em;
    font-size: 1.2em;
    -webkit-border-radius: 6px;
    width: 30%;
    position: relative;
    display: block;
    margin-left: auto;
    margin-right: auto;
    text-align: center;

}

a.down:hover{
    text-decoration: underline;
    color: white;

}

/*----------work main styles-------------*/
#leftColumn
{
    width: 50%;
    float: left;
    height: 80em;

}

#rightColumn
{
    width: 50%;
    height: 80em;
    float: right;
}

#label{
    width: 100%;
    height: 2em;
    top: 10em;
}

#work{
    width: 100%;
    height: 10em;
    position: relative;
    top: -11em;
}

h4{
    width: 100%;
    position: relative;
    font-family: 'Roboto', sans-serif;
    font-weight: 300;
    font-size: 40px;
    color: #45CCCC;
    opacity: 1.0;
    text-align: center;
}


#p2article2
{
  width: 70%;
  height:20em;
  float: center;
  display: block;
  margin-left: auto;
  margin-left: 60px;
  margin-bottom: 10em;
  margin-top: 5em;
  border: 1px solid #cccccc;
}
#p2article2 img
{
  border: 1px solid #cccccc;

}
a{
    text-decoration: none;
}

a:hover{
    text-decoration: underline;
    color: #45CCCC;
}

#p2article
{
  width: 70%;
  height:20em;
  float: center;
  display: block;
  margin-left: auto;
  margin-right: 60px;
  margin-bottom: 10em;
  margin-top: 5em;
  border: 1px solid #cccccc;
}

#articleinfo2
{
  width:100%;
  height:10em;
  display: block;
  margin-bottom: 5em;
}

#articleText2{
  width: 90%;
  height:70%;
  margin: 5%;
  font-family: 'Roboto', sans-serif;
  font-weight: 300;
  font-size: 30px;
  color: black;
}

最佳答案

盒子底部的标题有一个很大的高度设置和一个很大的底边距,就像这样

#articleinfo2 {
    margin-bottom: 5em;
    height: 10em
}

移除 10em 高度似乎并没有在这个模型状态下产生太大影响,只是它确实使间隙变得更小

关于html - 为什么我的 HTML 页面底部在我的内容下方有很大空间?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/29808094/

相关文章:

css - 如何更改内嵌的 HTML5 进度条颜色?

javascript - 在javascript中设置 margin 日历

javascript - 如何使用 CSS @font-face 设置 JavaScript 创建文本的样式

css - 过渡后悬停

CSS:为 'position: relative' 、 'position: fixed' 等使用一个类——这是个好主意吗?

iphone - 更改 UINavigationBar 高度

c# - 在 Windows Phone 8 中使 StackPanel 可滚动

javascript - 在旋转饼图的同时创建一个交互式表格

html - 如何将一个图像放入另一个图像并将文本和一个小图像放入该图像(最后一个)?