我的网页中缺少边框的底部

时间:2017-05-11 09:43:17

标签: html css web

我附加了html和css代码here

问题是,即使在css中使用overflow: scroll属性后,除非我将窗口调整为某个奇怪的比例,否则页面底部不可见。还有一个问题是,不只是边界。下面的所有内容都不可见,我无法滚动到下方看到它。将滚动属性赋予div容器会破坏图像位置。

body {
  background-color: #001126;
  margin: 0;
  overflow: scroll;
}

.container {
  border-style: solid;
  border-color: white;
  margin: 70px;
  color: white;
  padding: 80px;
  font-size: 30px;
  position: fixed;
}

.menu {
  top: -40px;
  left: -40px;
  position: absolute;
}

.social {
  margin-top: 5%;
  position: absolute;
}

.icons;
{
  position: absolute;
}

#img {
  padding-left: 20px;
  padding-bottom: 10px;
}
  <div class="container">
    <div class="contents">
      <p id="text">It is a long established fact that a reader will be distracted by the readable content of a page when looking at its layout. The point of using Lorem Ipsum is that it has a more-or-less normal distribution of letters, as opposed to using 'Content
        here, content here', making it look like readable English. Many desktop publishing packages and web page editors now use Lorem Ipsum as their default model text, and a search for 'lorem ipsum' will uncover many web sites still in their infancy.
        Various versions have evolved over the years, sometimes by accident, sometimes on purpose (injected humour and the like).</p>
    </div>
    <div class="menu"><img src="icon.png" style="height: 50%;width:50%"></div>
    <div class="social">
      <div class="icons">
        <img src="fb.png" style="height: 8%;width:8%" id="img">
        <img src="insta.png" style="height: 8%;width:8%" id="img">
        <img src="tw.png" style="height: 8%;width:8%" id="img">
        <img src="u.png" style="height: 8%;width:8%" id="img">
        <img src="vid.png" style="height: 8%;width:8%" id="img">
      </div>
    </div>

2 个答案:

答案 0 :(得分:2)

这是因为您将position: fixed提供给容器。

body {
  background-color: #001126;
  height: auto;
  margin: 0;
  overflow: scroll;
}

.container {
  border-style: solid;
  border-color: white;
  height: 100%;
  margin: 70px;
  color: white;
  padding: 80px;
  font-size: 30px;
}
<div class="container">
  <div class="contents">
    <p id="text">some large text</p>
  </div>
  <div class="menu"><img src="icon.png" style="height: 50%;width:50%"></div>
  <div class="social">
    <div class="icons">
      <img src="fb.png" style="height: 8%;width:8%" id="img">
      <img src="insta.png" style="height: 8%;width:8%" id="img">
      <img src="tw.png" style="height: 8%;width:8%" id="img">
      <img src="u.png" style="height: 8%;width:8%" id="img">
      <img src="vid.png" style="height: 8%;width:8%" id="img">
    </div>

答案 1 :(得分:0)

请在此处找到plunkr解决方案:

https://plnkr.co/edit/aA4aKpRa467kCuXcZ6bp?p=preview

&#13;
&#13;
body {
  background-color: #001126;
  margin: 0;
}

.container {
  border-style: solid;
  border-color: white;
  height: 100%;
  margin: 70px;
  color: white;
  padding: 80px;
  font-size: 30px;
}

.menu {
  top: -40px;
  left: -40px;
  position: absolute;
}

.social {
  margin-top: 5%;
  position: absolute;
}

.icons;
{
  position: absolute;
}

#img {
  padding-left: 20px;
  padding-bottom: 10px;
}
&#13;
<div class="container">
  <div class="contents">
    <p id="text">It is a long established fact that a reader will be distracted by the readable content of a page when looking at its layout. The point of using Lorem Ipsum is that it has a more-or-less normal distribution of letters, as opposed to using 'Content
      here, content here', making it look like readable English. Many desktop publishing packages and web page editors now use Lorem Ipsum as their default model text, and a search for 'lorem ipsum' will uncover many web sites still in their infancy.
      Various versions have evolved over the years, sometimes by accident, sometimes on purpose (injected humour and the like).</p>
  </div>
  <div class="menu"><img src="icon.png" style="height: 50%;width:50%"></div>
  <div class="social">
    <div class="icons">
      <img src="fb.png" style="height: 8%;width:8%" id="img">
      <img src="insta.png" style="height: 8%;width:8%" id="img">
      <img src="tw.png" style="height: 8%;width:8%" id="img">
      <img src="u.png" style="height: 8%;width:8%" id="img">
      <img src="vid.png" style="height: 8%;width:8%" id="img">
    </div>
  </div>
&#13;
&#13;
&#13;