顶部标签工作但底部不是。在codepen中编写代码

时间:2017-12-29 22:38:32

标签: html css



body {
  background-color: black;
}

.inner{
  margin-left:400px;
  color:white;
  width:650px;
  height:450px;

  top:130px;
  position:fixed;
  padding-left:30px;
  padding-right:30px;
  text-align:center;
  background-color:grey;
}

.outer {
  height:500px;
  width:1000px;
  top:100px; 
   bottom:0px;
  margin-left:260px;
  position:fixed;

  background-color:white;
}

<div class="outer">
</div>
<div class="inner">
    <img />
    <h2>RK</h2>
    <h5>wtv@wtc</h5>
    <a>
      Github 
    </a>

    <p>blah blah blah </p>

    <br>

    <p> blah blah blah</p>
</div>
&#13;
&#13;
&#13;

outer课程中,无论我多少改变底部,它都不会改变生成的网页上的任何内容。我认为这与块和内联有关,但我真的希望得到我的概念。有什么建议吗?

1 个答案:

答案 0 :(得分:0)

&#34;问题&#34;是使用top

时无法同时使用bottomposition:fixed属性

你可以&#34;抵消&#34;元素要么与屏幕底部相关,要么从顶部开始。如果删除top:100px,则div应该一直位于屏幕底部。 您还可以使用left属性并将其设置为而不是当前的margin-left属性。

您可以阅读有关不同定位选项here的更多信息。