Wrap text within a asp:Button

后端 未结 4 1649
情深已故
情深已故 2020-12-29 09:22

I was using a LinkButton and it had like lot of text in it which made it quite long. This was fine as the LinkButton wrapped the text onto the next line when it ran out of r

相关标签:
4条回答
  • 2020-12-29 09:56

    You can do that by setting a width and the CSS property white-space: normal:

    This goes in your <head>

    <style type="text/css">
        .wrap { white-space: normal; width: 100px; }
    </style>
    

    And your button:

    <asp:Button ID="btn" runat="server" Text="some really breally long text that I want to wrap" CssClass="wrap" />
    
    0 讨论(0)
  • 2020-12-29 10:02

    There are some alternate solutions in this post that may be helpful:

    ASP:Button Text Word Wrap

    0 讨论(0)
  • 2020-12-29 10:04

    You should be able to set a width on the asp:button (width=100) and that should force the text to wrap.

    0 讨论(0)
  • 2020-12-29 10:08
    <asp:Button ID="btn" runat="server" Text="some really breally long &#010; text that I want to wrap"  />
    

    This question was helpful and wanted to point out if we want to break the text in a specific spot we could also by adding the within the text value.

    I also marked wsanville answer as useful.

    0 讨论(0)
提交回复
热议问题