2017-09-05 43 views
0

如何禁止col-xl- *停止为更大的显示器增长? 当我在笔记本电脑(宽度为1280)和桌面(1920)上查看它时,它们都适用于col-xl,但它在桌面上太大或者在笔记本电脑上太小。col-xl- *(Bootstrap 4)处的静态宽度?

<div class="d-flex justify-content-center align-items-center text-center login-div "> 
    <div class="col-md-6 col-sm-8 col-lg-5 col-xl-3 col-10 rounded-10 mask"></div> 
</div> 

谢谢。

+2

将其包装在['.container'](http://getbootstrap.com/docs/4.0/layout/overview/)元素中。顺便说一句,Bootstrap'.col- *'应该总是在'.row'里面,而'.row'应该总是在'.container'或'.container-fluid'中。 – Blazemonger

回答

3

一种选择是使用media queries并限定max-width,可能是自举的XL breakpoint

@media (min-width: 1200px) { /* xl */ 
 

 
    .your-class { 
 
    background: yellow; 
 
    max-width: 200px; 
 
    } 
 
}
<div class="your-class">Hello</div>

使用上述代码,以.your-class类元件将具有200像素的最大宽度如果视口宽度至少为1200px。

+1

完美无缺。非常感谢你! –

+0

不客气。 :) – juzraai