如何在Div中的同一行放置文字?

时间:2016-04-08 10:25:06

标签: html asp.net asprepeater nowrap

我想将文本放在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>

text wrapping

有谁知道如何指定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>

1 个答案:

答案 0 :(得分:1)

所以请使用:

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

jsFiddle