未加星标

Why does the footer overlay the content?

字体大小 | |
[前端(javascript) 所属分类 前端(javascript) | 发布者 店小二04 | 时间 2018 | 作者 红领巾 ] 0人收藏点击收藏

I have a website in development here: http://184.173.208.195/~secoast/about/mission and it is supposed to have a "sticky footer" however, in order to get the drop shadow to show correctly on the bottom of the content I have had to modify the code slightly. In doing so the footer now comes up over the bottom of the content on long pages.

Here is the code for the sticky footer:

/* Begin Sticky Footer code */ html, body, #wrap { height: 100%;} body > #wrap { height: auto; min-height: 100%; } #main { padding-bottom: 50px; } /* must be same height as footer */ body.inside #main { height: 100%; margin-top: 5px; background: #fff url(../photos/bg_main.png) repeat-y; position: relative; -webkit-box-shadow: 3px 3px 5px rgba(50, 50, 50, 0.75); -moz-box-shadow: 3px 3px 5px rgba(50, 50, 50, 0.75); box-shadow: 3px 3px 5px rgba(50, 50, 50, 0.75); } .white-bar-top { width: 959px; height: 20px; margin-left: 1px; background: #fff; margin-top: -10px; } .white-bar-bottom { width: 959px; height: 20px; clear: both; background: #fff; position: absolute; bottom: 0; left: 1px; } #footer { position: relative; width: 100%; background-color: #dadfdb; margin-top: -50px; /* negative value of footer height */ height: 50px; clear: both; }

Here is the html

<!DOCTYPE html> <html lang="en"> <head> <!-- Meta Data --> <meta charset="UTF-8"> <meta name="author" content="SE Coastal Wind Coalition"> <!-- Title --> <title>Mission | About Us |SE Coastal Window Coalition</title> <meta name='keywords' content='your, default, keywords, here' /> <meta name='description' content='Your default description here' /> <link rel='canonical' href='http://184.173.208.195/~secoast/about/mission' /> <!-- generated by seo_lite --> <!-- Styles --> <link rel="stylesheet" href="http://184.173.208.195/~secoast/css/styles.css?v=1.0"> <link href='http://fonts.googleapis.com/css?family=Roboto+Condensed' rel='stylesheet' type='text/css'> <link rel="stylesheet" type="text/css" href="http://184.173.208.195/~secoast/fancybox/jquery.fancybox.css?v=2.0.6" media="screen" /> <!-- Scripts --> <script src="https://ajax.googleapis.com/ajax/libs/jquery/1.7.1/jquery.min.js"></script> <!--[if lt IE 9]> <script src="//html5shim.googlecode.com/svn/trunk/html5.js"></script> <![endif]--> <!-- <script src="http://cloud.github.com/downloads/malsup/cycle/jquery.cycle.all.latest.js"></script> --> <script src="http://184.173.208.195/~secoast/js/jquery.dropmenu.js"></script> <script> $(document).ready(function(){ $("#nav-one").dropmenu({ openAnimation: "size", closeAnimation: "slide", openSpeed: 300, closeSpeed: 200, closeDelay: 500, zindex: 1000 }); }); </script> <!-- Fancybox --> <script type="text/javascript" src="fancybox/jquery.fancybox.js?v=2.0.6"></script> <!-- page-specific scripts --> </head> <body class="inside base-3-col"> <div id="wrap"> <div id="header"> <!-- navigation code goes here --> </div><!-- end #header --> <div id="main" class="clearfix"> <img class="banner" src="http://184.173.208.195/~secoast//photos/banner-inside.jpg" alt="banner-inside" width="962" height="125" /> <div id="page-title-banner"> <h2>About the Southeast Coastal Wind Coalition</h2> </div> <div class="white-bar-top"></div> <div id="section-sub-nav"><!-- this only shows on base-3-col pages --> <ul> <li><a href="#">Nav One</a></li> <li><a href="#">Nav Two</a></li> <li><a href="#">Nav Three</a></li> <li><a href="#">Nav Four</a></li> </ul> </div> <div id="sidebar-nav" class="clearfix"> <ul> <li><a class="selected" href="http://184.173.208.195/~secoast/about/mission">Mission</a></li> <li><a href="http://184.173.208.195/~secoast/about/members">Members</a></li> <li><a href="http://184.173.208.195/~secoast/about/management">Management</a></li> <li><a href="http://184.173.208.195/~secoast/about/board-of-directors">Board of Directors</a></li> <li><a href="http://184.173.208.195/~secoast/about/state-policy-liaison">State Policy Liaison</a></li> </ul> </div> <div id="main-content"> <h3>Our Mission</h3> <p> <img alt="" src="http://184.173.208.195/~secoast/images/uploads/offshoregrande.jpg" style="width: 610px; height: 440px; " /><br /> <span style="font-size:9px;"><span style="font-family:trebuchet ms,helvetica,sans-serif;">PHOTO: COURTESY OF SIEMENS AG @2013. ALL RIGHTS RESERVED.</span></span></p> <p> Page text goes here.</p> </div><!-- end #content-two-thirds--> <div class="white-bar-bottom" class="white-bar"></div> </div><!-- end #main --> </div><!-- end #wrap --> <div id="footer"> <div id="footer-content"> <ul id="footer-nav"> <li class="no-icon"><a href="#">Donate</a></li> <li class="no-icon"><a href="#">Contact</a></li> <li><a class="social facebook" href="#">Facebook</a></li> <li><a class="social twitter" href="#">Twitter</a></li> <li><a class="social linkedin" href="#">LinkedIn</a></li> <li><a class="social youtube" href="#">Youtube</a></li> <li class="no-icon">2012 Southeast Coastal Wind Coalition</li> <li class="no-icon"><a href="http://www.rouviere.com">Website by Rouviere Media</a></li> </ul> </div><!-- end #footer-content --> </div><!-- end #footer --> </body> </html>

I would appreciate any help in getting the footer to stay below the main content.

Thanks.

It’s quite hard to recreate your page locally. You should consider creating a stand-alone sample of the issue that would allow others to debug.

But looking at your coding & your stated issue it seems that positioning your #footer with a margin-top: -50px; is what is causing the issue.

#footer { position: relative; width: 100%; background-color: #dadfdb; margin-top: -50px; /* negative value of footer height */ height: 50px; clear: both; }

You are positioning margin-top: -50px; to get the footer to stay, but it is now overlapping -50px over your main content, right?

So maybe the solution is to give the immediate <div> that comes before the footer a 50px margin―or even more―to compensate?

body.inside #wrap { height: 100%; margin-bottom: 50px; }

本文前端(javascript)相关术语:javascript是什么意思 javascript下载 javascript权威指南 javascript基础教程 javascript 正则表达式 javascript设计模式 javascript高级程序设计 精通javascript javascript教程

代码区博客精选文章
分页:12
转载请注明
本文标题:Why does the footer overlay the content&amp;quest;
本站链接:https://www.codesec.net/view/611095.html


1.凡CodeSecTeam转载的文章,均出自其它媒体或其他官网介绍,目的在于传递更多的信息,并不代表本站赞同其观点和其真实性负责;
2.转载的文章仅代表原创作者观点,与本站无关。其原创性以及文中陈述文字和内容未经本站证实,本站对该文以及其中全部或者部分内容、文字的真实性、完整性、及时性,不作出任何保证或承若;
3.如本站转载稿涉及版权等问题,请作者及时联系本站,我们会及时处理。
登录后可拥有收藏文章、关注作者等权限...
技术大类 技术大类 | 前端(javascript) | 评论(0) | 阅读(72)