2012-10-19

How to make word-wrap work for asp:Label

word-wrap CSS3 property won't work for inline elements. asp:Label is getting rendered as span in the browser. Spans are inline elements. So we have to specifically set the span to an inline-block behavior to get the word-wrap property to work with asp:Labels.

.test{
width:20px;
word-wrap:break-word;
display:inline-block
}

The above CSS class demonstrate of an example of how to properly set word-wrap for an asp:Label.

No comments: