bradley4
bradley4

Reputation: 3938

Wrapping text to new line inside div

I have two divs where the text inside them will often change. When the contents inside the two divs becomes two wide for the container div I would like the left div to wrap the text to a new line.

This is my desired results:
This is my desired result:

<html>
    <head>
         <style type="text/css">
             #header {
                position:relative;
                height: 100px;
                width:150PX;
              }

              #leftdiv {
                position: absolute;
                float:left;
                left:0px;
                bottom:0px;
                font-size: 10px; 
               }     

              #rightdiv {
                position:absolute;
                float:right;
                right:0px;
                bottom:0px;
                font-size: 10px; 
             }
          </style>
      </head>
      <body>
          <div id="header">
             <div id="leftdiv">Content in Left Div</div>
             <div id="rightdiv">Content in Right More</div>
          </div>
      </body>
</html>

Upvotes: 4

Views: 14766

Answers (1)

Andy897
Andy897

Reputation: 7133

Use this word-wrap: break-word;

Assign all those divs in which you want text to wrap a class and then style that class using word-wrap: break-word;

Upvotes: 5

Related Questions