这更像是一个最佳实践问题。所以,假设我在 Bootstrap 中有两个列,我希望将正确的列设置为 300 像素,直到它到达 768 像素断点,然后将其堆叠。
<div class="container">
<div class="row">
<!-- This column needs to fill the rest of the container fluidly -->
<div class="col-sm-8"></div>
<!-- This column needs to stay 300px -->
<div class="col-sm-4"></div>
</div>
</div>
Run Code Online (Sandbox Code Playgroud)
我最初的解决方案是只向每个容器添加类,并为每个媒体断点静态设置两个容器的宽度,然后在堆栈断点上将宽度设置为 auto。但是,我不喜欢这个解决方案,因为它非常冗长,而且将列都设置为静态似乎太脆弱了。我更喜欢左列使用动态混合或设置百分比。
有什么想法吗?谢谢!