Mar 29

Tagged in: Comments:Add

Word-Wrap: Force Text to Wrap

Today I’m going to talk about a rarely used but extremely useful CSS property, the word-wrap. You can force long (unbroken) text to wrap in a new line by specifying break-word with the word-wrap property. For example, you can use it to prevent text extending out the box and breaking the layout. This commonly happens when you have a long URL in the sidebar or comment list. Word-wrap is supported in IE 5.5+, Firefox 3.5+, and WebKit browsers such as Chrome and Safari.

CSS: Word-Wrap Property (view demo)

You can specify either normal or break-word value with the word-wrap property. Normal means the text will extend the boundaries of the box. Break-word means the text will wrap to next line.

.break-word {
  word-wrap: break-word;
}

break word

Delicious Stumbleupon Digg

Weebly Contest ($13,000 in Prizes) New WordPress Theme: Koi

Comments

Pages: 8 7 6 5 4 3 2 1 » Show All

There are 72 comments (+Add)

  • 72 divineantony

    nice work.
    thank u…………

  • 71 Selena

    Great topic! Thank you very much!

    I found a lot of usefull tips here :) Thanks for sharing.

  • 70 campi

    How do I have to apply to WYSIWYG editor(CK Editor)?
    Have just I add this line into:

    /template/system/editor.css
    or
    my template’s css?

    Just it?

    It doesn’t work;(

  • 69 xxx

    It seems to work only in IE.

  • 68 cone crusher http://www.iconecrusher.com

    Nice..love your site

  • 67 shano

    youuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuu

  • 66 shano

    Excellent thank youuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuu

  • 65 Holly Perkins http://filesharepoint.com

    Try this one
    div { word-wrap: break-word }

    Here is some content for the div element
    Files Sharing

  • 64 Marcel http://www.nostromo.nl

    Thanks for this, I looked for a few hours how to solve the long_urls_in_sidebar issue :)

  • 63 zia

    Nice..love your site

Pages: 8 7 6 5 4 3 2 1 » Show All

Post Your Comments

(required)

(required)

Comment Guidelines

  • Please keep comments related to topic. And be nice, don't spam!
  • Basic HTML tags are allowed:
    <a href> <abbr> <acronym> <blockquote> <code> <em> <strike> <strong>
  • Note: un-related or spam comments will be deleted.

Live Comment Preview

Back to top