Html 引导向右拉将表推到固定宽度容器外

Html 引导向右拉将表推到固定宽度容器外,html,css,twitter-bootstrap-3,Html,Css,Twitter Bootstrap 3,当我有一个col-xs-6和pull right时,它包含一个表,该表使用text nowrap类100%扩展,该类将单元格扩展到col-xs-6之外,它从固定宽度的容器向右流出。我希望它应该向左流动,并使右边界对齐。这可能吗 理解这个问题的最好方法是看下面的代码 我也在这里粘贴代码,以防链接不起作用(它需要bootstrap3) 项目1 420 小计长文本 420 全部的 420 更新:我的容器需要精确到400px,更改容器大小不是一个选项。您的问题似乎是文本nowrap如果删除此类,文

当我有一个
col-xs-6
pull right
时,它包含一个表,该表使用
text nowrap
类100%扩展,该类将单元格扩展到
col-xs-6
之外,它从固定宽度的容器向右流出。我希望它应该向左流动,并使右边界对齐。这可能吗

理解这个问题的最好方法是看下面的代码

我也在这里粘贴代码,以防链接不起作用(它需要bootstrap3)


项目1
420
小计长文本
420
全部的
420

更新:我的容器需要精确到400px,更改容器大小不是一个选项。

您的问题似乎是
文本nowrap
如果删除此类,文本将返回到表中,但我可以看到文本然后进入多行

下面是为我修复它的代码:

<div class="container-fluid" style="width:450px; background:#CCC;">
    <div class="row">
        <div class="col-md-12">
            <table border="1" width="100%">
                <tbody>
                    <tr>
                        <td>Item 1</td>
                        <td class="text-right">420.00</td>
                    </tr>
                </tbody>
            </table>
        </div>
    </div>
    <div class="row">
        <div class="col-md-6 pull-right">
            <table border="1" width="100%">
                <tbody>
                    <tr>
                        <td class="text-nowrap">Sub Total with long text</td>
                        <td class="text-right">420.00</td>
                    </tr>
                    <tr>
                        <td>Total</td>
                        <td class="text-right">420.00</td>
                    </tr>
                </tbody>
            </table>
        </div>
    </div>
</div>

项目1
420
小计长文本
420
全部的
420
我只是把你的桌子放大了50px,希望你的桌子不需要精确到400px,如果你不放大50px,问题就会解决P


祝您好运:)

谢谢您的输入,但事实上,我的容器/表格需要精确到400px(这是一个可打印的布局)。是的,我使用的是bootstrap 3+Hmmm。。给我2分钟在我的电脑上复制
<div class="container-fluid" style="width:450px; background:#CCC;">
    <div class="row">
        <div class="col-md-12">
            <table border="1" width="100%">
                <tbody>
                    <tr>
                        <td>Item 1</td>
                        <td class="text-right">420.00</td>
                    </tr>
                </tbody>
            </table>
        </div>
    </div>
    <div class="row">
        <div class="col-md-6 pull-right">
            <table border="1" width="100%">
                <tbody>
                    <tr>
                        <td class="text-nowrap">Sub Total with long text</td>
                        <td class="text-right">420.00</td>
                    </tr>
                    <tr>
                        <td>Total</td>
                        <td class="text-right">420.00</td>
                    </tr>
                </tbody>
            </table>
        </div>
    </div>
</div>