Search code examples
c#asp.netcssnewlineellipsis

hyperlink is dropped to new line


This is my aspx code,

<div class="ellipsis">
Body Text Body Text Body Text Body Text Body   
Text Body Text Body Text Body Text Body !!!
</div>
<asp:HyperLink ID="HyperLink1" runat="server">
    <span style="color: Maroon; font-style: italic; font-size: small;">
        More..
    </span>
</asp:HyperLink>

CSS

.ellipsis
{ 
    width:               250px;
    white-space:         nowrap;
    overflow:            hidden;
    text-overflow:       ellipsis;
    -o-text-overflow:    ellipsis;
    -ms-text-overflow:   ellipsis;
    -moz-binding:        url('ellipsis.xml#ellipsis');
}

I want to show single line likes

 Body Text Body Text ...More..

But the hyperlink HyperLink1 is dropped to new line . How can I fix it ?

This is Fiddle !


Solution

  • Add a style:

    float:left;
    

    to both the div and the link