【发布时间】:2013-12-29 19:54:45
【问题描述】:
我正在尝试在有限的固定背景图像上滚动文本(不确定它的确切名称 - 它就像视差滚动但背景图像根本不移动?)并且一切都很好,除了我得到一个“上部”图像底部和背景图像底部之间的小(5-10px)边距或填充。
下边距和下边距都设置为 0px(我也试过 0%,没有改善)。我也尝试了负边距和负填充,这两者都没有任何效果。
我尝试了一个简单的 CSS 重置,它解决了一个带有不需要的边距的单独问题,但这个问题仍然存在。 (而且在每个浏览器中都是一样的。)
我确定我遗漏了一些非常简单的东西,但我还没有找到这个确切问题的答案。非常感谢任何见解。
*
{
margin: 0px;
padding: 0px;
}
#text_and_image
{
text-align: center;
font-family: 'Montserrat Subrayada', sans-serif;
background: url(/images/fountain.png);
background-attachment: fixed;
background-size: 100%;
padding-top: 25%;
padding-bottom: 0px;
margin-bottom: 0px;
background-repeat: no-repeat;
}
HTML:
<div id="text_and_image">
<p>this is the third one<br>it has both TEXT<br>and an IMAGE</p>
<img src="/images/bird_palm.png">
</div>
【问题讨论】: