css - Bootstrap : `well` inside a `span` /`row` goes beyond its container: how to make it fill "only" width=100% of it?

标签 css layout html twitter-bootstrap

我有一个 Bootstrap well 超出其包含元素的问题(这里是一个 class="row" ,它本身在一个 class="span4")。

它在我在这里做的 JSFidle 中清晰可见:http://jsfiddle.net/sebastien_worms/fc42w/2/
全屏:http://jsfiddle.net/sebastien_worms/fc42w/2/embedded/result/

代码摘录在这里:

<div class="span4 pull-right">
    <div class="row">
        <div class="well" style="width:100%;">
            <b>This is the well that bothers me !</b><br> It goes beyond the right end of the screen ... And if you click "inspect element", you can see it goes beyond the right-end of its containing "span4" and "row"...
        </div>
    </div>
</div>

在调整浏览器的窗口大小(最明显的宽度约为 1000 像素)时,您可以看到井超出了其包含元素(和屏幕)。

...显然,我不能将 well 设置在与 span 相同的 div 中:http://jsfiddle.net/sebastien_worms/fc42w/3/

我应该怎么做才能让 well 填充 100%(仅)span4

最佳答案

这是因为你的填充,只需添加这个

.well {
    box-sizing: border-box;
}
  • 它适用于任何现代浏览器和 IE8 及更新版本

关于css - Bootstrap : `well` inside a `span` /`row` goes beyond its container: how to make it fill "only" width=100% of it?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/12978032/

相关文章:

html - 如何在不使用 flex 盒的情况下将 "div"拉伸(stretch)到父级的完整高度?

jquery - 在 jQuery Mobile 中垂直居中 DIV 的内容

css - 菜单链接对齐不起作用

c# - 找不到与命名空间 'urn:UmbracoHelper' 关联的脚本或扩展对象

css - 带有CSS的水平列表中的乱码元素

javascript - 左侧为粘性侧边栏,右侧为可滚动内容的布局

html - css 样式表 :hover does not work when background image set from js.

css - 在文本区域内放置一个警告框

css - 水平对齐这些 CSS div

java - 如何将底部导航与抽屉导航一起使用