How to word-wrap long text in HTML?

In HTML a very long text is not automatically wrapped. Especially if there are no spaces in your string your browser doesn’t necessarily know where it should break the line.


In most cases you don’t want the people use the horizontal scrollbar to read the entire text but CSS allows you to force the browser to show all the text in multiple lines. CSS offers the properties white-space and word-wrap for this purpose.

div {
    white-space: pre-wrap;      /* CSS3 */
    white-space: -moz-pre-wrap; /* Firefox */
    white-space: -pre-wrap;     /* Opera <7 */
    white-space: -o-pre-wrap;   /* Opera 7 */
    word-wrap: break-word;

After applying the above rules on your text containers the result looks as follows.


Different browsers don't handle long text the same way. In firefox the long text got already wrapped without the CSS rules applied. It was able to detect special characters that were url-encoded and broke the lines on these positions.


Nonetheless you should never rely on this automatic detection but teach every browser that you really want to wrap so that you get the same result everywhere.


  1. Dit is heel belangrijk, zoals een docent zal altijd de
    boodschap gemakkelijker. Meer dan één miljard records bestaan nu in de database en kunnen worden gesorteerd of.
    U kunt uw telecommunicatiebedrijf over eventuele speciale functies die zij hebben op het gebied van kinderveiligheid.

  2. Thanks for the good writeup. It actually was once a entertainment account it.
    Glance complex to far delivered agreeable from you! However, how can we be in contact?

  3. Hi, all the time i used to check webpage posts here in the early hours in the morning, as i enjoy to learn more
    and more.

  4. 3-stone: As the name implies, a three-stone alexandrite ring has three

  5. If you are plannіng to cгеate your own platter, it is possiblе to ցo for an arrangement of eggѕ, onions, dill,
    oⅼives, and lеmon wedgeѕ. These Сertified Kitchen Designers (CKDs) are fully qualified in assisting shoppers with ƅridging the
    gap betwеen personal tɑste along with thе form of intimate, techniϲal knowledge
    required for the creation of these designs.
    If it is possible to contact the correct center, you don’t have to worry in relɑtіon to
    approѵal from counseling, getting of thᥱ root ɗetails abⲟut the dog
    owner and necessary consultancy as reqᥙired from all of these Property advisory
    prօfessionals and organizations to make the proper decision ɑt
    the best time.

  6. The salеsmаn, we are going to phone him Bob, had decided
    to create his carԀ stick out a little by putting his picture onto it plus a couple of
    color pіϲtures of his furniture. Vendors make curѵed track lighting for
    sale іn all styleѕ, dealing with every type of environments, from your rustic on the sophіsticated.
    “Western” style decorɑtions are similar to the rural theme; with
    increased of your influence from the “old West.

  7. china jerseys
    - Professional Jerseys Online Cheap Outlet Sale, wholesale best jerseys From
    China Store for NFL Fans. Buy Discount NFL Football Jerseys, Hockey jerseys here.

  8. Making any office as elegant and inspiring as you possibly can would result in the employee’s work potential and artistic
    process. The more natural style uses flowers from matching areas or points during the year.
    When working with an accumulation paintings, photos or prints, try exercising the
    configuration around the floor to be ideal before you begin hanging

  9. Everything is very open with a clear explanation of the challenges.
    It was truly informative. Your site is very useful.
    Many thanks for sharing!

  10. Have you ever considered about including a little bit more than just your articles?
    I mean, what you say is fundamental and all.
    However imagine if you added some great photos or video clips to give your posts more, “pop”!
    Your content is excellent but with pics and videos, this blog could definitely
    be one of the best in its field. Good blog!

  11. Hal

    I havve been browsing online more tha three hours today, yet I
    never found any ijteresting article like yours. It is pretty worth enough
    for me. In my view,if all website owners and bloggeers made good
    content as you did, the internet wwill be a lot
    more useful than ever before.

  12. Fine way of explaining, and pleasant article to obtain data about my presentation subject matter,
    which i am going to convey in school.

  13. In other words, the beast does eat pig, metaphorically speaking.
    On tonight’s episode, the crew shut off the pump, allowing Sam
    to reach the surface. One of such planet is Rahu which is taken as malefic planet and it is
    believed that if it will take unfavorable move, any loss
    can be happened.

  14. It’s really a nice and useful piece of info. I am glad that you shared this useful
    information with us. Please keep us up to date like this.
    Thank you for sharing.

  15. As the net continues to evolve and change the same is true the way that you shop.
    Thus if you are buying Cheap Car Insurance via an agent, learn better in regards to the kind of insurance and just how it is going to benefi you.
    You can search for a web auction site from tthe comfort of your fave search engine to discover a site offering thhe automobile you
    may need, at a price thast it is possible to afford.

  16. I see you don’t monetize your site, i think there is one opportunity to earn extra money on your

  17. est un site vous proposant des astuces, actualités et des tutoriels Clash Royale. Très souvent mise à jour, reconnu par la communauté du jeu. Ce site est surement la référence pour obtenir des gemmes illimités mais aussi des ressources.

  18. Muito agradavel essa leitura que tive

  19. One of such planet is Rahu which is taken as malefic planet and it is
    believed that if it will take unfavorable move, any loss
    can be happened.

  20. Sure It Has Kettlebells And Barbells, And All The Usual Things And Exercises You Eee in most Gyms.
    Also, distorted views of what ‘getting too big’ is exactly,
    are a worry. Do the study, learn the procedures and then let
    go a little, after all you are there because you want to do a skydive

  21. Genuinely when someone doesn’t be aware of afterward its up to other people
    that they will assist, so here it takes place

  22. Greetings from Colorado! I’m bored at worfk so I decided to browse
    your blog on my iphone during lunch break. I rsally like thhe information you provide here and can’t wait
    to take a look when I get home. I’m shocked at how fast your bblog loaded on my
    cell phone .. I’m not even using WIFI, jus 3G .. Anyhow, awesome site!

    Feel fee to visit my website shop design

  23. Elite/throwback/authentic/replica whl hockey jerseys for you,
    access our site by click: cheap nfl jersey sell

  24. Wonderful post! We are linking to this particularly great content on our website.
    Keep up the great writing.

  25. To take care to

  26. Hello. I see that you don’t update your blog too often. I
    know that writing content is boring and time consuming.
    But did you know that there is a tool that allows you to create new posts using existing content (from article directories or other blogs
    from your niche)? And it does it very well. The new posts
    are high quality and pass the copyscape test. You should
    try miftolo’s tools

  27. Cette jeune femme nous raconte sa première fois.

  28. Thanks for the code. I am a beginner at HTML and it is quite easy. but I got stuck somewhere. Just as I stuck at this problem. I didn’t know how to wrap long text. I am gonna try this and hope it will work. Thanks again and keep sharing!!

  29. It’s awesome to pay a visit this web site and reading the views of all friends regarding this
    post, while I am also eager of getting experience.

  30. Thank you for every other informative site. Where else could I get that type of information written in such an ideal manner?
    I’ve a undertaking that I am just now running on, and I have been at the look
    out for such info.

Leave a Reply

Your email address will not be published. Required fields are marked *

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>