1

我想将文本放置在 div 中,以便文本行保持在同一行并且不会换行。

我尝试的是nwrp通过添加一些示例文本来将属性添加到 div,但如下面的屏幕截图所示,文本换成了多行:

<div runat="server" id="OfferStatusString" class="col-xs-3 col-sm-3 col-md-2 nwrp"><p><strong>This text is strong, testing that the text doesn't wrap to the next line using nwrp property of bootstrap. Text should stay on the same line on the window</strong>.</p></div>

文字环绕

有谁知道如何指定 div 文本定位以保持在同一行?

此 div 包含在 Repeater 控件中,如下所示:

<asp:Repeater ID="repeaterApplicationItems" runat="server" OnItemDataBound="repeaterApplicationItems_ItemDataBound" >
                                <ItemTemplate>
                                    <div class="row applicationitems mrgn lhgt">

                                        <div runat="server" id="OfferStatusString" class="col-xs-3 col-sm-3 col-md-2 nwrp"><strong><%# (string)Eval("ApplicationItemStatusString").ToString() %></strong></div>


                                    </div>
                               </ItemTemplate>
                            </asp:Repeater>
4

1 回答 1

1

所以使用这个:

div {
    overflow: hidden;
    white-space: nowrap;
}

jsFiddle

于 2016-04-08T10:30:55.413 回答