【问题标题】:Sidebar cut off by footer侧边栏被页脚截断
【发布时间】:2014-05-16 10:07:02
【问题描述】:

我正在开发自己的网站,这仍然非常非常业余,但我遇到了一个我自己似乎无法解决的问题。

我只是添加了一个带有内容的侧边栏(没什么特别的,只是一些填充文本),但页脚截断了我的侧边栏的文本,而不是主要内容的文本。

这是我的 HTML:

<div id="content">
    <div id="main">
        <h1>PHP</h1>
    </div>
    <div id="sidebar">
        <h2>Sidebar</h2>

        <p>
        Hello, this is just some filler tekst. Blablabla blabl blabla blabla blblbla blablalbabla blablalbl.<br>
        <br>
        As you can see, it's positioned well.
        </p>
    </div>
</div>

<div id="footer">
<p>Made by me 2014</p>
</div>

这是我的 CSS:

#content {
background          :   linear-gradient(#669900, #66FF99); /* Gradient -                        Standaard */
background          :   -moz-linear-gradient(#669900, #66FF99); /* Gradient  - Firefox */
background-repeat   :   no-repeat;
background-attachment:  fixed;
/*margin-left       :   185.5px;
  margin-right      :   185.5px;*/
margin              :   0 auto;
width               :   980px;
position            :   relative;
padding             :   20px 0 25px 0;
border-left         :   5px solid lightgreen;
border-right        :   5px solid lightgreen;
}

#main {
padding             :   0 30px 0 30px;
margin-right        :   200px;
}

#sidebar {
position            :   absolute;
top                 :   0;
bottom              :   0;
left                :   780px;
width               :   180px;
float               :   right;
margin              :   0 10px 0 10px;
overflow            :   auto;
}

#sidebar h2 {
text-align          :   center;
margin-left         :   -15px;
}

抱歉,我知道要阅读的内容很多,但希望您能提供帮助。

我的问题是:页脚不会随着侧栏中的文本移动,它会切断它,但是当主 div 中添加了文本时它会移动。

谁能帮忙?

最大

【问题讨论】:

  • 带走overflow:auto;
  • 是>>> it (click :: JSFiddle)<<<的效果,你要get吗?
  • @BeatAlex:我已经把它放在那里尝试修复它,忘了把它拿走。没修。 :P
  • @Benio:是的。这就是我想要实现的目标。

标签: html css footer sidebar


【解决方案1】:

同样的问题,但是在将位置从绝对位置更改为相对位置时,侧边栏移动到帖子下方

.sidebar-wrapper {
  width: 300px;
  position: absolute;
  right: 0px;
  margin: 25px 0;
  padding: 0 20px;
  border: medium none;
  top: 0;
  bottom: 0;
  display: block;
}

【讨论】:

  • 为您的答案添加更多描述。
  • 兄弟访问此链接并转到该页面底部blogolectlab2.blogspot.com侧边栏重叠页脚
猜你喜欢
  • 2014-05-12
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2017-08-17
  • 1970-01-01
  • 2011-09-11
  • 2021-08-25
  • 2016-01-12
相关资源
最近更新 更多