Html 如何修复屏幕末尾的页脚

Html 如何修复屏幕末尾的页脚,html,css,Html,Css,我希望页脚固定在屏幕的末尾 我在中添加了属性style=“position:fixed”,没有任何更改。 我的页面页脚的图片如下 请尝试使用以下代码: `#footer { position:absolute; bottom:0; width:100%; height:60px; /* Height of the footer */ }` 这应该在所有浏览器中都能很好地工作。如果您对此有任何进一步的问题,请告诉我。尝试以下CSS规则: #footer { //

我希望页脚固定在屏幕的末尾 我在
中添加了属性
style=“position:fixed”
,没有任何更改。 我的页面页脚的图片如下
请尝试使用以下代码:

`#footer {
   position:absolute;
   bottom:0;
   width:100%;
   height:60px;   /* Height of the footer */
}` 

这应该在所有浏览器中都能很好地工作。如果您对此有任何进一步的问题,请告诉我。

尝试以下CSS规则:

#footer {
  // Specify the fixed position for the footer
  position: fixed;

  // Position it at the bottom of the screen
  left: 0px;
  bottom: 0px;

  // Make it span across 100% of the browser's width
  width:100%;
}
希望有帮助

使用以下代码:

`#footer {
   position:absolute;
   bottom:0;
   width:100%;
   height:60px;   /* Height of the footer */
}` 
HTML: #康特纽{ 身高:100%; }


我帮你解决了这个问题,你可以随时检查

<body>  

<div id="content">  

 <div id="text"></div>  

</div>  

<div id="footer"></div>  

</body> 


* {  
 margin: 0;  
 padding: 0;  
}  
html, body {height: 100%;} 

#content {  
 position: relative;  
 min-height: 100%;
 border:1px solid red;
}  

* html #content {  
 height: 100%;

}  
#text {  
 padding-bottom: 100px;
        border:1px solid green;
}  
#footer {  
 position: relative;  
 height: 80px;  
 margin-top: -80px; 
 border:2px solid black;
} 

* {  
保证金:0;
填充:0;
}  
html,正文{高度:100%;}
#内容{
位置:相对位置;
最小高度:100%;
边框:1px纯红;
}  
*html#内容{
身高:100%;
}  
#文本{
填充底部:100px;
边框:1px纯绿色;
}  
#页脚{
位置:相对位置;
高度:80px;
利润上限:-80px;
边框:2件纯黑;
} 
请参见演示:


您可以尝试使用此html代码,该代码可以正常工作但是它将
#页脚
从文档流中取出。这就是为什么您必须使用
width:100%

<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
    <title></title>
    <style type="text/css">
        *
        {
            padding: 0;
            margin: 0;
        }
        html, body
        {
            min-height: 100%;
            height: 100%;
        }
        #footer
        {
            position: absolute;
            bottom: 0px;
           /* width: 100%; */
        }
    </style>
</head>
<body>
    <div id="footer">
        this is a footer
    </div>
</body>
</html>

*
{
填充:0;
保证金:0;
}
html,正文
{
最小高度:100%;
身高:100%;
}
#页脚
{
位置:绝对位置;
底部:0px;
/*宽度:100%*/
}
这是一个页脚
因此,我建议使用这个html结构,它将保持文档流,并为您提供一个干净的(html4)结构

<style type="text/css">
    *
    {
        padding: 0;
        margin: 0;
    }
    html, body
    {
        min-height: 100%;
        height: 100%;
    }
    #header  { height: 20%;  }
    #content { height: 70%;  }
    #footer  { height: 10%;  }
</style>

<div id="header"></div>
<div id="content"></div>
<div id="footer">
    this is a footer
</div>

*
{
填充:0;
保证金:0;
}
html,正文
{
最小高度:100%;
身高:100%;
}
#标题{高度:20%;}
#内容{高度:70%;}
#页脚{高度:10%;}
这是一个页脚
<style type="text/css">
    *
    {
        padding: 0;
        margin: 0;
    }
    html, body
    {
        min-height: 100%;
        height: 100%;
    }
    #header  { height: 20%;  }
    #content { height: 70%;  }
    #footer  { height: 10%;  }
</style>

<div id="header"></div>
<div id="content"></div>
<div id="footer">
    this is a footer
</div>