Search code examples
htmlasp.netasprepeaternowrap

How to position text on same line in Div?


I want to position text in a div so that the line of text stays on the same line and doesn't wrap onto multiple lines.

What I have tried is adding the nwrp property to the div, by adding some sample text but as shown in the screenshot below the text wraps onto multiple lines:

<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

Does anyone know how to specify the div text positioning to stay on the same line?

This div is contained within a Repeater control as shown below:

<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>

Solution

  • So use this:

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

    jsFiddle