css - Bootstrap 容器在中型设备和小型设备上全屏显示,但在大型设备上显示一半

标签 css twitter-bootstrap twitter-bootstrap-3 bootstrap-4

我正在使用 Bootstrap 容器来满足我的要求。容器完全适合我想要的大屏幕。但是我的要求是在中屏和小屏上填充容器

容器在小屏幕上是全宽的,但是对于中等屏幕,宽度与大屏幕相同。

我的屏幕变量

$xsBreakpoint: 0px;
$smBreakpoint: 576px;
$mdBreakpoint: 768px;
$lgBreakpoint: 1024px;
$xlBreakpoint: 1200px;

容器 css 占用全高

.container {
      padding: 0px 0 !important;
    }

使用容器的 HTML 组件

<div class="container">
  <app-help-support-component></app-help-support-component>
</div>

大屏截图,完美满足我的要求

enter image description here

在如下图的小屏幕上,要把空格去掉,占满整个屏幕

enter image description here

我想删除空格,容器应该占据整个宽度。

最佳答案

您需要添加媒体查询以根据需要更改中型设备的容器宽度(设备宽度 <= 1024 像素)。

要在中型设备中更改容器宽度,您需要将以下媒体查询代码添加到您的 css:

@media (max-width: 1024px){
  .container {
    max-width: 100%;
  }
}

关于css - Bootstrap 容器在中型设备和小型设备上全屏显示,但在大型设备上显示一半,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/59315049/

相关文章:

css3动画暂停在屏幕中间

html - 尝试使用类似于此的 HTML 和 CSS 对网格进行编码

css - React maskImage 内联不起作用 - 与 backgroundImage 相同的图像

javascript - 尝试通过 JavaScript 显示 Bootstrap 模态时 IE11 出错

jquery - Bootstrap 3 Collapse show state with Chevron 图标

css - Bootstrap 堆积柱

css svg 过滤器 safari 不工作

css - 多媒体查询

jquery - Bootstrap 轮播指示器在点击时不会改变

html - 带间隙的 5 卡 Bootstrap