Wrap Label Text in asp.net


Today I found one issue with my site, that is a label text was not wrapped and display continued. Found finally working solution:

 <div style="float:left;overflow-y:auto;overflow-x:auto; word-break:break-all;">
	<asp:Label ID="lbDesc" runat="server" />
</div>
Advertisements
Tagged with: ,
Posted in Asp.Net
3 comments on “Wrap Label Text in asp.net
  1. When i display a long text, the whole word doesnt wrap completely, and it becomes like this

    ——————
    |this is a text this i|
    | s a text |
    ——————

    As you can see, the word ‘is’ is splitted. Is it possible to make the whole word ‘is’ go to the next line so it becomes like this??

    ——————
    |this is a text this |
    | is a text |
    ——————

    • pahamad says:

      I didn’t tried but try with different option:

      white-space: pre; /* CSS 2.0 */
      white-space: pre-wrap; /* CSS 2.1 */
      white-space: pre-line; /* CSS 3.0 */
      white-space: -pre-wrap; /* Opera 4-6 */
      white-space: -o-pre-wrap; /* Opera 7 */
      white-space: -moz-pre-wrap; /* Mozilla */
      white-space: -hp-pre-wrap; /* HP Printers */
      word-wrap: break-word; /* IE 5+ */

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

Top Rated

Error: Twitter did not respond. Please wait a few minutes and refresh this page.

Blog Stats
  • 30,188 hits
%d bloggers like this: