【发布时间】:2020-08-10 02:05:14
【问题描述】:
我正在尝试在容器中使用 class='row' 获得 100% 的宽度
HTML 结构:
<div class="container"><!-- this is main container holding overall contents dont want to remove it -->
<div class='row w-100 bg-dark' id='heading'>
<h2>some headings</h2>
</div>
<article></article>
<aside></aside>
<footer></footer>
</div>
id='heading' 的行没有扩展到 100% 宽度,因为它在容器类中,我使用了布局实用程序 w-100,但它不起作用。
如何强制此 div 扩展至 100% 但仍保留在容器中?
【问题讨论】:
-
yup 容器是问题所在,请改用
container-fluid,如果您不希望列之间有间距,请在row上添加no-gutters,至少一个列应该是row的子级你有 -15px 这将导致水平滚动条错误 -
会影响整个版面!我只是想让
#heading成为 100% 而不是其他区域。
标签: bootstrap-4