我的页脚与内容重叠有问题。 看小提琴: https://jsfiddle.net/xrdjsu58/
我尝试了很多提示,但似乎没有任何工作,我认为页脚的CSS是可以的,也许在内容的某个地方就是问题。
#footer {
border-top: 1px solid #d3d3d3;
padding: 3px;
width: 100%;
height: 75px;
position: absolute;
bottom: 0;
/* overflow: hidden;
z-index: -1;*/
left: 0;
}
.body-content {
padding-left: 15px;
padding-right: 15px;
padding-bottom: 75px;
}
<div class="container body-content">
<h2>Tarif</h2>
Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Aenean commodo ligula eget dolor. Aenean massa. Cum sociis natoque penatibus et magnis dis parturient montes, nascetur ridiculus mus. Donec quam felis, ultricies nec, pellentesque eu, pretium quis, sem. Nulla consequat massa quis enim. Donec pede justo, fringilla vel, aliquet nec, vulputate eget, arcu. In enim justo, rhoncus ut, imperdiet a, venenatis vitae, justo. Nullam dictum felis eu pede mollis pretium. Integer tincidunt. Cras dapibus. Vivamus elementum semper nisi. Aenean vulputate eleifend tellus. Aenean leo ligula, porttitor eu, consequat vitae, eleifend ac, enim. Aliquam lorem ante, dapibus in, viverra quis, feugiat a, tellus. Phasellus viverra nulla ut metus varius laoreet. Quisque rutrum. Aenean imperdiet. Etiam ultricies nisi vel augue. Curabitur ullamcorper ultricies nisi. Nam eget dui. Etiam rhoncus. Maecenas tempus, tellus eget condimentum rhoncus, sem quam semper libero, sit amet adipiscing sem neque sed ipsum. Nam quam nunc, blandit vel, luctus pulvinar, hendrerit id, lorem. Maecenas nec odio et ante tincidunt tempus. Donec vitae sapien ut libero venenatis faucibus. Nullam quis ante. Etiam sit amet orci eget eros faucibus tincidunt. Duis leo. Sed fringilla mauris sit amet nibh. Donec sodales sagittis magna. Sed consequat, leo eget bibendum sodales, augue velit cursus nunc,</div>
<div id="footer">
<center>
<script src="/Scripts/script.js"></script><a href=""><img src="http://services.webestools.com/images/s3_0.gif" class="cpt_viu_28885" alt="0" style="border:0px;"><img src="http://services.webestools.com/images/s3_0.gif" class="cpt_viu_28885" alt="0" style="border:0px;"><img src="http://services.webestools.com/images/s3_0.gif" class="cpt_viu_28885" alt="0" style="border:0px;"><img src="http://services.webestools.com/images/s3_1.gif" class="cpt_viu_28885" alt="1" style="border:0px;"><img src="http://services.webestools.com/images/s3_2.gif" class="cpt_viu_28885" alt="2" style="border:0px;"></a>
<span class="fl-footer-site-stat-key">Numar Vizualizari</span>
</center>
<footer>
<span>© 2015 - Diagnoza Auto</span>
</footer>
</div>
答案 0 :(得分:1)
将position: absolute;
更改为position: relative;
#footer {
border-top: 1px solid #d3d3d3;
padding: 3px;
width: 100%;
height: 75px;
position:relative; /* Changed this */
bottom: 0;
/* overflow: hidden;
z-index: -1;*/
left: 0;
}
更新了Fiddle
答案 1 :(得分:1)
我已更新元素的位置fixed
。使用以下css:
#footer {
border-top: 1px solid #d3d3d3;
padding: 3px;
width: 100%;
background: #fff;
height: 75px;
position: fixed;/*updated*/
bottom: 0;
left: 0;
}
UPDATED DEMO:更改背景以获得更清晰。
答案 2 :(得分:1)
使用position: fixed;
并设置z-index
,使其高于文字。并应用背景颜色。像这样:
#footer {
border-top: 1px solid #d3d3d3;
padding: 3px;
width: 100%;
height: 75px;
position: fixed;
bottom: 0;
z-index: 10;
background-color: #fff;
left: 0;
}
答案 3 :(得分:1)
也许您正在寻找this呢?
插入媒体查询:
@media screen and (min-width: 800px) {
#footer { display: none; }
}
#
footer {
border - top: 1px solid# d3d3d3;
padding: 3px;
width: 100 % ;
height: 75px;
position: fixed;
background: #FFFFFF;
bottom: 0;
/* overflow: hidden;
z-index: -1;*/
left: 0;
}
.body - content {
padding - left: 15px;
padding - right: 15px;
padding - bottom: 75px;
}@
media all and(max - width: 480px) {#
footer {
display: none;
}
}
<div class="container body-content">
<h2>Tarif</h2>
Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Aenean commodo ligula eget dolor. Aenean massa. Cum sociis natoque penatibus et magnis dis parturient montes, nascetur ridiculus mus. Donec quam felis, ultricies nec, pellentesque eu, pretium quis,
sem. Nulla consequat massa quis enim. Donec pede justo, fringilla vel, aliquet nec, vulputate eget, arcu. In enim justo, rhoncus ut, imperdiet a, venenatis vitae, justo. Nullam dictum felis eu pede mollis pretium. Integer tincidunt. Cras dapibus. Vivamus
elementum semper nisi. Aenean vulputate eleifend tellus. Aenean leo ligula, porttitor eu, consequat vitae, eleifend ac, enim. Aliquam lorem ante, dapibus in, viverra quis, feugiat a, tellus. Phasellus viverra nulla ut metus varius laoreet. Quisque rutrum.
Aenean imperdiet. Etiam ultricies nisi vel augue. Curabitur ullamcorper ultricies nisi. Nam eget dui. Etiam rhoncus. Maecenas tempus, tellus eget condimentum rhoncus, sem quam semper libero, sit amet adipiscing sem neque sed ipsum. Nam quam nunc, blandit
vel, luctus pulvinar, hendrerit id, lorem. Maecenas nec odio et ante tincidunt tempus. Donec vitae sapien ut libero venenatis faucibus. Nullam quis ante. Etiam sit amet orci eget eros faucibus tincidunt. Duis leo. Sed fringilla mauris sit amet nibh.
Donec sodales sagittis magna. Sed consequat, leo eget bibendum sodales, augue velit cursus nunc,</div>
<div id="footer">
<center>
<script src="/Scripts/script.js"></script>
<a href="">
<img src="http://services.webestools.com/images/s3_0.gif" class="cpt_viu_28885" alt="0" style="border:0px;">
<img src="http://services.webestools.com/images/s3_0.gif" class="cpt_viu_28885" alt="0" style="border:0px;">
<img src="http://services.webestools.com/images/s3_0.gif" class="cpt_viu_28885" alt="0" style="border:0px;">
<img src="http://services.webestools.com/images/s3_1.gif" class="cpt_viu_28885" alt="1" style="border:0px;">
<img src="http://services.webestools.com/images/s3_2.gif" class="cpt_viu_28885" alt="2" style="border:0px;">
</a>
<span class="fl-footer-site-stat-key">Numar Vizualizari</span>
</center>
<footer> <span>© 2015 - Diagnoza Auto</span>
</footer>
</div>
调整宽度,在某些时候页脚会消失。