如何永久地将页脚放在页面底部

时间:2016-09-29 10:29:12

标签: html css

如何在页脚内写字并将其保留在页面底部?



.underbar {
bottom:0;
width:100%;
height:60px;
background:#000000;
}

<footer class="underbar">

</footer>
&#13;
&#13;
&#13;

9 个答案:

答案 0 :(得分:1)

.underbar {
bottom:0;
width:100%;
height:60px;
background:#000000;
position: fixed;
}

添加属性位置:已修复;

答案 1 :(得分:0)

使用position:fixed property

.underbar {
bottom:0;
width:100%;
height:60px;
background:#000000;
 position:fixed;
}
<footer class="underbar">

</footer>

答案 2 :(得分:0)

我试过了,检查可能会对你有帮助

&#13;
&#13;
foo(_:,y:)
&#13;
func foo(xx x: Int, yy y: Int) //declares foo(xx:yy:) and

func foo(_ x: Int, y: Int) //explicitly declares foo(_:y:)
&#13;
&#13;
&#13;

答案 3 :(得分:0)

您可以在css中添加position属性。

.underbar {
position:fixed;
bottom:0;
width:100%;
height:60px;
background:#000000; 
}

您可以将文字放在页脚标记内。

<footer class="underbar">
    Your text here
</footer>

答案 4 :(得分:0)

您可以使用以下内容:

position: fixed;
right: 0;
bottom: 0;
left: 0;

它会起作用!

您可以在下面找到代码的jfiddle示例:

https://jsfiddle.net/2wqrg2zu/

答案 5 :(得分:0)

&#13;
&#13;
<style>
            .underbar {
                 bottom:0;
                 width:100%;
                 height:60px;
                 background:#000000;
                 position: fixed;
                }
         </style>
&#13;
<HTML>
     <HEAD>
         
    </HEAD>
    <BODY>
        <footer class="underbar">
         footer
        </footer>
    </BODY>
</HTML>
&#13;
&#13;
&#13;

答案 6 :(得分:0)

检查

Engine
html,
body {
  height: 100%;
  margin: 0;
  padding: 0;
}
#container {
  min-height: 100%;
  position: relative;
}
#header {
  background: #ff0 none repeat scroll 0 0;
  padding: 10px;
}
#body {
  padding: 10px 10px 60px;
}
#footer {
  background: #6cf none repeat scroll 0 0;
  bottom: 0;
  height: 60px;
  position: absolute;
  width: 100%;
}
#header p,
#header h1 {
  margin: 0;
  padding: 10px 0 0 10px;
}
#footer p {
  margin: 0;
  padding: 10px;
}

答案 7 :(得分:0)

&#13;
&#13;
* {
	margin: 0;
}
html, body {
	height: 100%;
}
.wrapper {
	min-height: 100%;
	margin: 0 auto -60px; 
        background:green;
}
footer{
	height: 60px; 
        background:#000000;
        color:#ffffff;
        text-align:center;

}

.push {
	height: 60px; 

}

header{
  background:gold;
}
&#13;
<!DOCTYPE html>

<div class="wrapper">

    <header>
	<h1>Fixed Footer</h1>
    </header>
             
    <div class="push"></div>
              
  </div>
  
   <footer>
       <h5>
       Fixed Footer
       </h5>
  </footer>
&#13;
&#13;
&#13;

答案 8 :(得分:-1)

首先将这些脚本添加到您的文档中。

<head>
  <link href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css" rel="stylesheet" integrity="sha384-BVYiiSIFeK1dGmJRAkycuHAHRg32OmUcww7on3RYdg4Va+PmSTsz/K68vbdEjh4u" crossorigin="anonymous">
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/js/bootstrap.min.js" integrity="sha384-Tc5IQib027qvyjSMfHjOMaLkfuWVxZxUPnCJA7l2mCWNIpG9mGCD8wGNIcPD7Txa" crossorigin="anonymous"></script>
  </head>

然后将“footer navbar-fixed-bottom”类添加到页脚。 多数民众赞成应该有效。

<footer class="footer navbar-fixed-bottom"> </footer>