css始终将footer固定在底部的方法

本篇文章和大家了解一下css始终将footer固定在底部的方法。有一定的参考价值,有需要的朋友可以参考一下,希望对大家有所帮助。

css始终将footer固定在底部的方法

目标:

把 footer 区固定在底部,无论页面高度多宽,它始终在底部不会变,就像移动端的菜单一样。

实例:

<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8" />
<title>document</title>
 
<!-- css -->
<style>
#demo{
 position: fixed;
    left: 0px;
    bottom: 0px;
    width: 100%;
    height: 50px;
    background-color: #eee;
    z-index: 9999;
}
</style>
 
</head>
<body>
<footer id="demo">我是footer</footer>
</body>
</html>

以上就是css始终将footer固定在底部的方法的详细内容了,看完之后是否有所收获呢?如果想了解更多相关内容,欢迎来亿速云行业资讯!