Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to make text in <a> tag wordwrap

I want to make text in <a> tag fit in a fixed div, but it breaks the div and displays ugly.

enter image description here

like image 457
hungneox Avatar asked Dec 01 '11 04:12

hungneox


2 Answers

There's a CSS3 property: word-wrap: break-word

Take a look at the MDN word-wrap docs for more info.

like image 81
Chris Fulstow Avatar answered Oct 12 '22 22:10

Chris Fulstow


pre {
      white-space: pre-wrap;       /* css-3 */
      white-space: -moz-pre-wrap;  /* Mozilla, since 1999 */
      white-space: -pre-wrap;      /* Opera 4-6 */
      white-space: -o-pre-wrap;    /* Opera 7 */
      word-wrap: break-word;       /* Internet Explorer 5.5+ */
      width: 30px;
    }
<pre><a href="#">aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa</a></pre>
like image 32
Subha Avatar answered Oct 12 '22 20:10

Subha