Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/html/90.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/8/redis/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Css html5的粘性页脚_Css_Html_Footer_Sticky - Fatal编程技术网

Css html5的粘性页脚

Css html5的粘性页脚,css,html,footer,sticky,Css,Html,Footer,Sticky,我希望我的页脚粘在页面底部,因此当页面小于屏幕时,页脚无论如何都应该在底部。但它不应与css文件中的边距冲突。因此,当我为某些内容使用边距时,它不会弄乱页面。尝试使用固定位置和css3calc()函数: 尝试使用固定位置和css3calc()功能: 尝试使用固定位置和css3calc()功能: 尝试使用固定位置和css3calc()功能: 只需将页脚设置为位置:绝对和底部:0只需将页脚设置为位置:绝对和底部:0只需将页脚设置为位置:绝对和底部:0只需将页脚设置为位置:绝对和底部:0您只需要创建包

我希望我的页脚粘在页面底部,因此当页面小于屏幕时,页脚无论如何都应该在底部。但它不应与css文件中的边距冲突。因此,当我为某些内容使用边距时,它不会弄乱页面。

尝试使用固定位置和css3
calc()
函数:


尝试使用固定位置和css3
calc()
功能:


尝试使用固定位置和css3
calc()
功能:


尝试使用固定位置和css3
calc()
功能:


只需将页脚设置为
位置:绝对
底部:0
只需将页脚设置为
位置:绝对
底部:0

只需将页脚设置为
位置:绝对
底部:0
只需将页脚设置为
位置:绝对
底部:0

您只需要创建
包装器div
并从那里取出页脚。然后,使此包装中的页边距底部等于页脚高度,并创建一些
push
div-它将是页脚的位置。
看看这个:

您只需要创建
包装器div
,然后从那里取出页脚。然后,使此包装中的页边距底部等于页脚高度,并创建一些
push
div-它将是页脚的位置。
看看这个:

您只需要创建
包装器div
,然后从那里取出页脚。然后,使此包装中的页边距底部等于页脚高度,并创建一些
push
div-它将是页脚的位置。
看看这个:

您只需要创建
包装器div
,然后从那里取出页脚。然后,使此包装中的页边距底部等于页脚高度,并创建一些
push
div-它将是页脚的位置。
看看这个:

这是一个创建粘性页脚的好例子,但页脚块需要固定高度:

CSS:

HTML:


你的网站内容在这里

版权所有(c)2008


这是一个创建粘性页脚的好例子,但页脚块需要固定高度:

CSS:

HTML:


你的网站内容在这里

版权所有(c)2008


这是一个创建粘性页脚的好例子,但页脚块需要固定高度:

CSS:

HTML:


你的网站内容在这里

版权所有(c)2008


这是一个创建粘性页脚的好例子,但页脚块需要固定高度:

CSS:

HTML:


你的网站内容在这里

版权所有(c)2008


也许他下午走了。也许他下午走了。也许他下午走了。也许他下午走了。这是迄今为止最简单、最小的解决方案!这是迄今为止最简单、最小的解决方案!这是迄今为止最简单、最小的解决方案!这是迄今为止最简单、最小的解决方案!
* {
margin: 0;
}
html, body {
height: 100%;
}
.wrapper {
min-height: 100%;
height: auto !important;
height: 100%;
margin: 0 auto -50px;
}
.footer, .push {
height: 50px;
}
<html>
<head>
    <link rel="stylesheet" href="layout.css" ... />
</head>
<body>
    <div class="wrapper">
        <p>Your website content here.</p>
        <div class="push"></div>
    </div>
    <div class="footer">
        <p>Copyright (c) 2008</p>
    </div>
</body>