Html 引导:仅在较大屏幕中显示固定页脚?
我目前是Bootstrap(3.3.4)的新手,我的发布站点的页脚位置似乎有问题。我只希望页脚固定在更大的屏幕上(平板电脑和电脑),而不是移动屏幕上 由于Bootstrap现在首先是移动的,所以我不会在css代码中明确声明页脚的位置样式(因为我不希望它被修复),除了我的大屏幕媒体查询:Html 引导:仅在较大屏幕中显示固定页脚?,html,css,twitter-bootstrap,less,css-preprocessor,Html,Css,Twitter Bootstrap,Less,Css Preprocessor,我目前是Bootstrap(3.3.4)的新手,我的发布站点的页脚位置似乎有问题。我只希望页脚固定在更大的屏幕上(平板电脑和电脑),而不是移动屏幕上 由于Bootstrap现在首先是移动的,所以我不会在css代码中明确声明页脚的位置样式(因为我不希望它被修复),除了我的大屏幕媒体查询: /* Extra small devices (phones, less than 768px) */ /* No media query since this is the default in Bootstr
/* Extra small devices (phones, less than 768px) */
/* No media query since this is the default in Bootstrap */
/* Small devices (tablets, 768px and up) */
@media (min-width: @screen-sm-min) {
/* Pull out the header and footer */
.mastfoot {
position: fixed;
bottom: 0;
}
}
/* Medium devices (desktops, 992px and up) */
@media (min-width: @screen-md-min) {
/* Pull out the header and footer */
.mastfoot {
position: fixed;
bottom: 0;
}
}
/* Large devices (large desktops, 1200px and up) */
@media (min-width: @screen-lg-min) {
/* Pull out the header and footer */
.mastfoot {
position: fixed;
bottom: 0;
}
}
但是,这会导致它无法在任何设备中固定。当我在媒体查询之外设置以下内容时,它最终会在我不想要的每个设备中被修复:
.mastfoot {
position: fixed;
bottom: 0;
}
我怎样才能使我的站点仅为大于768px宽的设备显示固定页脚?您在代码中显示的不是CSS,而是“更少”。如果你在CSS中使用它,它将不起作用。您在媒体查询中使用的变量较少,例如:
@screen sm min、@screen md min和@screen lg min
您希望确保将CSS的变量更改为实际像素尺寸,如下所示:
/* Large devices (large desktops, 1200px and up) */
@media (min-width: 1200px) {
/* Pull out the header and footer */
.mastfoot {
position: fixed;
bottom: 0;
}
}
当您更加熟悉LESS时,最好在LESS文件本身中进行这些修改,然后输出CSS。虽然这是主观的,但更明智的做法是学习SASS而不是少学
但这是一个完全不同的讨论。哦,哇。我不知道。这就是我没有深入研究的结果。谢谢@xengravity一定会探索SASS!很高兴这有帮助。我想很多初学者都会对这一部分感兴趣,因为如果你以前没有看过,你就不知道什么是LESS或SASS。