粘性HTML页脚不起作用

时间:2014-11-14 08:52:03

标签: html css css3 sticky

所以我在这里查看了所有这些粘贴页脚的帖子......并尝试了每一个"修复"我可以找到,但我仍然无法进行页脚显示并坚持到页面底部。我不确定它是否与我在页面中的响应式iFrame有关 - 但这似乎消除了页脚。我得到的最接近的是让页脚在内容上方漂浮到底部,但我不能让它粘在底部,内容停在页脚上方。您可以给予的任何帮助真的很感激!



html {
  position: relative;
  min-height: 100%;
}
body {
  font-family: 'pt_sansregular';
  background-image: url(images/body_bg.jpg);
  background-repeat: repeat;
}
body,
td,
th {
  font-family: "pt_sansregular";
  color: #FFFFFF;
}
a:link {
  color: #FF0004;
  text-decoration: none;
}
a:visited {
  text-decoration: none;
  color: #DC7F81;
}
a:hover {
  text-decoration: none;
  color: #FD5F61;
}
a:active {
  text-decoration: none;
}
body {
  font-family: 'pt_sansregular';
  font-size: 12px;
  color: #000 margin: 0 0 95px;
}
.header {
  background: url(../images/Top_Pattern.png) repeat-x;
  height: 85px;
  width: 100%;
}
.footer {
  background: url(../images/Foot_Pattern.png) repeat-x;
  height: 95px;
  width: 100%;
  text-align: center;
  margin-top: 5px;
  color: #fff;
  font-size: 14px;
  position: absolute;
  left: 0;
  bottom: 0;
}

<script type="text/javascript">
  function setIframeSource() {
    var theSelect = document.getElementById('location');
    var theIframe = document.getElementById('preview-frame');
    var theUrl;

    theUrl = theSelect.options[theSelect.selectedIndex].value;
    theIframe.src = theUrl;
  }
</script>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width,initial-scale=1.0">
<style>
  html body {
    width: 100%;
    height: 100%;
    padding: 0px;
    margin: 0px;
    overflow: hidden;
    font-family: arial;
    font-size: 10px;
    color: #6e6e6e;
    background-color: #000;
  }
  #preview-frame {
    width: 100%;
    background-color: #fff;
  }
</style>
<script src="//ajax.googleapis.com/ajax/libs/jquery/1.10.2/jquery.min.js"></script>
<script>
  var calcHeight = function() {
    $('#preview-frame').height($(window).height());
  }

  $(document).ready(function() {
    calcHeight();
  });

  $(window).resize(function() {
    calcHeight();
  }).load(function() {
    calcHeight();
  });
</script>
</head>

<body>
  <div class="header">
    <div class="wrapper">
      <div class="logo">
        <img src="images/easyadminlogo.png" width="180" height="57" alt="" />
      </div>
      <div class="dropdown">
        <form id="form1" name="form1" method="post" action="">
          <label>


            <select name="location" id="location" onchange="setIframeSource()">
              <option value="http://www.saviodesigns.com/easyadmin/">Select a Module ...</option>
              <option value="../admin_cms/">PowerCMS</option>
              <option value="../news/">News Manager</option>
              <option value="../resources/">Resources/Links Manager</option>
              <option value="../blog/">Academic Portal Manager</option>
            </select>
          </label>
        </form>

      </div>
      <a href="http://www.saviodesigns.com/contact.php" target="_blank" class="infolink">
        <img src="images/requestquate.png" border="0" />
      </a>
      <div class="clear"></div>
    </div>
  </div>
  <p align="center">
    <iframe id="preview-frame" src="http://www.saviodesigns.com/easyadmin/" frameborder="0" noresize="noresize" scrolling="yes">
  </p>

  </div>

  <div class="footer">
    <div class="wrapper">
      <p align="center"><em> To get help and ongoing support, please <a href="http://www.saviodesigns.com/faq_support.php" target="_blank">click here</a>.
    </em>
        <p>Savio Designs Easy Admin Copyright &copy;
          <?php $then=2 007; $now=d ate( 'Y'); if ($then==$ now) echo $now; else echo "2014 - $now"; ?>
          <a href="http://www.saviodesigns.com" target="_blank">SavioDesigns.com</a>, All Rights Reserved.</a>
        </p>
    </div>

  </div>


</body>

</html>
&#13;
&#13;
&#13;

2 个答案:

答案 0 :(得分:0)

这是您的代码。打开时别忘了关闭标签。改变你自己的颜色!

&#13;
&#13;
<!DOCTYPE html>
<html>
<head>
<title>Title</title>

</head>
<body>

<style type="text/css">
body {
	font: 100%/1.4 Verdana, Arial, Helvetica, sans-serif;
	background: #42413C;
	margin: 0;
	padding: 0;
	color: #000;
}

a:link {
	color: #FF0004;
	text-decoration: none;
}
a:visited {
	text-decoration: none;
	color: #DC7F81;
}
a:hover {
	text-decoration: none;
	color: #FD5F61;
}
a:active {
	text-decoration: none;
}

/* ~~ this fixed width container surrounds the other divs ~~ */
.container {
	width: 960px;
	background: #FFF;
	margin: 0 auto; /* the auto value on the sides, coupled with the width, centers the layout */
}

/* ~~ the header is not given a width. It will extend the full width of your layout. It contains an image placeholder that should be replaced with your own linked logo ~~ */
.header {
	background: #ADB96E;
}

/* ~~ This is the layout information. ~~ 

1) Padding is only placed on the top and/or bottom of the div. The elements within this div have padding on their sides. This saves you from any "box model math". Keep in mind, if you add any side padding or border to the div itself, it will be added to the width you define to create the *total* width. You may also choose to remove the padding on the element in the div and place a second div within it with no width and the padding necessary for your design.

*/

.content {

	padding: 10px 0;
}

/* ~~ The footer ~~ */
.footer {
	padding: 10px 0;
	background: #CCC49F;
}

/* ~~ miscellaneous float/clear classes ~~ */
.fltrt {  /* this class can be used to float an element right in your page. The floated element must precede the element it should be next to on the page. */
	float: right;
	margin-left: 8px;
}
.fltlft { /* this class can be used to float an element left in your page. The floated element must precede the element it should be next to on the page. */
	float: left;
	margin-right: 8px;
}
.clearfloat { /* this class can be placed on a <br /> or empty div as the final element following the last floated div (within the #container) if the #footer is removed or taken out of the #container */
	clear:both;
	height:0;
	font-size: 1px;
	line-height: 0px;
}
-->
</style>
</style>
<script type="text/javascript">
			function setIframeSource() {
				var theSelect = document.getElementById('location');
				var theIframe = document.getElementById('preview-frame');
				var theUrl;
				
				theUrl = theSelect.options[theSelect.selectedIndex].value;
				theIframe.src = theUrl;
			}
		</script>
              <meta charset="utf-8">
      <meta name="viewport" content="width=device-width,initial-scale=1.0">
      <style>
       #preview-frame {width: 100%;background-color: #fff;}</style>
      <script src="//ajax.googleapis.com/ajax/libs/jquery/1.10.2/jquery.min.js"></script>
      <script>
         var calcHeight = function() {
           $('#preview-frame').height($(window).height());
         }

         $(document).ready(function() {
           calcHeight();
         }); 

         $(window).resize(function() {
           calcHeight();
         }).load(function() {
           calcHeight();
         });
      </script>
</head>

<body>
<div class="container">
  <div class="header">
	<div class="wrapper">
    	<div class="logo"> <img src="images/easyadminlogo.png" width="180" height="57" alt=""/>  </div><div class="dropdown">
    	<form id="form1" name="form1" method="post" action="">
<label>


<select name="location" id="location" onchange="setIframeSource()">
<option value="http://www.saviodesigns.com/easyadmin/">Select a Module ...</option>
<option value="../admin_cms/">PowerCMS</option>
<option value="../news/">News Manager</option>
<option value="../resources/">Resources/Links Manager</option>
<option value="../blog/">Academic Portal Manager</option>
</select>
</label>
</form>
        
 <!-- end .header -->       </div>
  <div class="content">
        <a href="http://www.saviodesigns.com/contact.php" target="_blank" class="infolink"><img src="images/requestquate.png" border="0" /></a>
        <div class="clear"></div>
    </div>
</div>
<p align="center">
<iframe id="preview-frame" src="http://www.saviodesigns.com/easyadmin/" frameborder="0" noresize="noresize" scrolling="yes"></iframe>
</p>


    <!-- end .content --></div>
  <div class="footer">
	<div class="wrapper">
<p align="center"><em> To get help and ongoing support, please <a href="http://www.saviodesigns.com/faq_support.php" target="_blank">click here</a>.
    </em>
<p>Savio Designs Easy Admin Copyright &copy;<?php
$then = 2007;
$now = date('Y');
if ($then == $now)
echo $now;
else
echo "2014 - $now"; ?>  
  <a href="http://www.saviodesigns.com" target="_blank">SavioDesigns.com</a>, All Rights Reserved. </a></p>
    </div>

    <!-- end .footer --></div>
  <!-- end .container --></div>
</body>
</html>
&#13;
&#13;
&#13;

祝你好运!

答案 1 :(得分:0)

您应该将bottom设置为0,并使div在滚动条的底部可用。