Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/jquery/78.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
Javascript 没有内容时如何在底部设置页脚_Javascript_Jquery_Html_Css - Fatal编程技术网

Javascript 没有内容时如何在底部设置页脚

Javascript 没有内容时如何在底部设置页脚,javascript,jquery,html,css,Javascript,Jquery,Html,Css,设计人 A)页脚已修复: footer { background-color: skyblue; position:fixed; bottom: 0; width: 100%; } 页脚{ 背景色:天蓝色; 位置:固定; 底部:0; 宽度:100%; } 设计人 只需将其添加到css中。您有三个选项,我建议您使用flex box 1.位置:固定 2.柔性箱 HTML 演示: 3.桌子 HTML 演示:您需要位置:固定


设计人

A)页脚已修复:

footer {
    background-color: skyblue;
    position:fixed;
    bottom: 0;
    width: 100%;
}
页脚{
背景色:天蓝色;
位置:固定;
底部:0;
宽度:100%;
}

设计人


只需将其添加到css中。

您有三个选项,我建议您使用flex box

1.位置:固定 2.柔性箱 HTML

演示:

3.桌子 HTML


演示:

您需要位置:固定吗?
footer {
  position: fixed;
  bottom: 0;
}
footer {
    position: fixed;
    left: 0;
    bottom: 0;
    right: 0;
}
<html>
    <body>
        <main></main>
        <footer></footer>
    </body>
</html>
html {
    height: 100%;
}

body {
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}

main {
    flex-grow: 1;
}
<html>
    <body>
        <main></main>
        <footer></footer>
    </body>
</html>
html {
    height: 100%;
}

body {
    display: table;
    min-height: 100vh;
}

main: {
    height: 100%;
}

footer {
    display: table-row;
    height: 1px;
}