在我的HTML中,我在单独的部分中有一些页脚元素,然后是页面的一个全局页脚元素.我想只使全局页脚显示在视口的底部.
如果我这样做,它将影响所有的页脚:
footer {
position: fixed;
bottom: 0px;
}
Run Code Online (Sandbox Code Playgroud)
如果我这样做,它按预期工作,但body
语法看起来很难:
body > footer {
position: fixed;
bottom: 0px;
}
Run Code Online (Sandbox Code Playgroud)
有没有更好的方法来指定顶级页脚?