【发布时间】:2015-06-01 11:27:05
【问题描述】:
我目前是 Bootstrap (3.3.4) 的新手,我的启动站点的页脚位置似乎有问题。我只希望将页脚固定在更大的屏幕(平板电脑和电脑)上,而不是移动设备上。
由于 Bootstrap 现在是移动优先的,我没有在我的 CSS 中明确声明页脚的位置样式(因为我不想修复它),除了我的大屏幕媒体查询:
/* 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;
}
如何让我的网站仅在宽度大于 768 像素的设备上显示固定页脚?
【问题讨论】:
标签: html css twitter-bootstrap less