Perfect Coders
Perfect Coders

Reputation: 67

CSS - break line without breaking words

I am working with content management and there is issue created with line break. I am displaying some content and it not gets break in multiple lines automatically. So I used CSS property "word-wrap:break-word".

When I used it, line gets braked but it cutting words of end of line.

I want to break only line and not a word.

Is there any solution ?

HTML

<div class="profile_fields">
 <ul>
  <li>
    <span id="CE_profile">Description:</span>
    <span>Join us in this 90 minute presentation and learn the indications and 
          "how to" for practical topics that will improve your diagnostic and
           treatment skills with cats. 
    </span> 
  </li>
 </ul>
</div>

CSS

.profile_fields {
    margin-top: 10px;
    overflow: hidden;
}
.profile_fields > ul {
    padding: 10px;
}
.profile_fields > ul > li > span + span {
    width: 330px !important;
    word-wrap: break-word;
}
.profile_fields > ul > li > span + span {
    display: block;
    float: none;
    min-width: 0;
    overflow: hidden;
    width: 380px;
}

I want to break content of second span in multiple lines

Fiddle: http://jsfiddle.net/fpTwP/

Upvotes: 2

Views: 2304

Answers (1)

jonas vermeulen
jonas vermeulen

Reputation: 1245

try this:

   word-break: keep-all;

more info on word breaking in css can be found here: http://docs.webplatform.org/wiki/css/properties/word-break

Upvotes: 2

Related Questions