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. Sehr ѕcҺöner Artiке&#8572!

    Іϲɦ ǥuсҝе mіг ѕeɦг
    ցегne Vі&#8574eos üb&#6513г &#8574aѕ Intегnet аn. &#5081οгаl&#8572еm &#8572іеbе ісɦ Αmа&#7458&#11423n Prіme &#8548іɗеο.

  2. The Holly clutch comes in gorgeous shades of violet of Tiffany Blue(R)
    croco. And it even comes into three sizes – small for 13-inch
    laptops, medium for 15-inch laptops and large for 17-inch laptops (Price: $14.
    Select Encouraged Perpetually continue sure lighting, starting from
    Pre lit christmas 1, D 1, R 0, Z D1 and as well , R 1 constitute continual source of
    home engine performance enterprise, Ic 2S , PH, R 2 ~ R 4 way infrared wr signal, i would say the indicate combining up the K 1

  3. 84″ x 30″ x 3/8″ with reinforcing meshed back by fiberglass net

    4 pcs=1set

    soap dish and shampoo shelf by natural stone granite, the same color and texture

    96″ x 2″ x 3/4″ trim

    Morestone Granite and Marble Limited
    Stone Supplier for Hospitality and Multifamily Industry

  4. wonderful put up, very informative. I ponder why the opposite experts of this sector don’t realize this.
    You must continue your writing. I am sure, you’ve a huge
    readers’ base already!

  5. excellent points altogether, you simply won a brand new reader.
    What may you recommend about your post that you made a few days in the past?
    Any certain?

  6. Hi friends, its impressive post regarding tutoringand fully explained, keep it up all the time.

  7. What’s up, I desire to subscribe for this website to take latest
    updates, therefore where can i do it please assist.

  8. Hi mates, how is everything, and what you would like to say about this piece
    of writing, in my view its in fact awesome in favor of me.

  9. Among the Top Intenet Entrepredneurs all over the world share their advertising secrets and techniquues in movies, which is offered
    to all of the members.

    My blog: leads online marketing –,

  10. Wowԝ tҺat աas unusual. ӏ juѕt ѡгоtе аn eхtгеmᥱlʏ ⅼοng cοmmеnt ƅut аftᥱг Ι clіϲқᥱd ѕսbmіt mу cⲟmmеnt dіԁn’t sҺоᴡ ᥙⲣ.
    Gгггг… ԝеⅼⅼ I’m not ѡгіting
    ɑⅼll tҺɑt oᴠеr аgаіn. Ɍеǥaгɗlеѕѕ, jᥙѕt wanted tο ѕаʏ ǥгeat ƅlоg!

    mү hοmеpaցе;

  11. Pretty part off content. I simply stumbled upon your
    blog and in accession capital tto claim tha I gett iin fact enjoyed account your blog posts.
    Anyway I will be subscribing on your augment or even I
    fulfillment you get right of entry to consistently rapidly.

  12. The industrial relations component extends far beyond overseeing the implementation of labor laws.
    Building from scratch can raise the cost significantly especially if the
    restaurant is a franchise where specific building requirements must be followed.
    Having the appropriate safety training and qualifications are essential for anyone looking to work,
    or further their career in the construction industry.

  13. Very good blog post. I absolutely love this website.
    Keep writing!

  14. Hi colleagues, how is the whole thing, and what you would like to
    say on the topic of this piece of writing, in my view its actually
    amazing Facetime for Android phone (Jaclyn) me.

  15. Aw, this waѕ an exceptionally ǥood post. Ꭲaking a few minutes and actual
    effoft tߋ generate а superb article… Ƅut աhɑt caan Ӏ ѕay… I procrastinate
    а ᴡhole lot and ԁon’t manage
    tߋ gеt anything ⅾօne.

    Feeel free tⲟ visit mү blog …
    2016 volvo s60 changes salon simi

  16. It’s going to be ending of mine day, except before ending I am reading this great paragraph
    to increase my know-how.

  17. I went for a one of a kind gift and uncovered this painting that lighting within just
    the dark.
    Its somekind of doual-view portray. I can view it for the duration of the working day, nonetheless after is dim within the
    space, the painting is continue to apparent.
    Is this some form of alien technology/ or is specifically some
    exceptional wall artwork?
    However, i made a decision in the direction of consider it as a gift, nonetheless in direction of purchase some for myself too :
    I feel that in make a difference of presents, this would
    be the major. Do oneself experience the very same?

  18. Nice blog here! Also your web site so much up fast!
    What host are you the usage of? Can I am getting your associate hyperlink to your host?
    I desire my site loaded up as quickly as yours lol

    my blog post pisownia a e om on em en test

  19. Each global conglomerate or multinational organisation was as soon ass a small enterprise.

    Here is mmy homepage … Small Business Loans, Surfingbird.Ru,

  20. Hiya very cool web site!! Man .. Excellent .. Superb ..
    I will bookmark your website and take the feeds also? I am satisfied
    to seek out numerous helpful info right here in the publish,
    we need work out more strategies on this regard, thanks for sharing.
    . . . . .

  21. Ok, so i wanted to make my bedroom very special at a low price
    and high quality. Then, i found this wallpaper from startonight, which is lighting during the night.
    But… if you take a look at the pictures, you can see that the people and
    items from this wallpaper from startonight, are simply escape from the wall.
    Imagine how strange and nice is to see your mural wall
    art during the night, while is glowing and the things are simply getting our of the wall.

    I don’t intend to call it advertising, but i am so amazed about this
    special wallpaper since i have it on my bedroom,
    that i feel to share to everyone and to offer you the same pleasures
    i have now. And is way cheaper than everyone expected.

    I found it at but
    make sure that you look for the 3d ones, because there are wallpapers that are not 3d too.

  22. Thanks for any other fantastic article. Where else may anyone get that type of info in such a perfect approach of
    writing? I have a presentation subsequent week,
    and I’m at the search for such information.

    My site Space Hulk Ascension – Salamanders crack

  23. I like it whe individuals come together аnd share opinions.
    Great site, stick with іt!

    Herre іѕ mʏ web blog … 5 hp air compressors

  24. I would like to thank you for the efforts you’ve put
    in penning this website. I really hope to check out
    the same high-grade blog posts by you in the future as well.
    In truth, your creative writing abilities has motivated me to get my own, personal site now ;)

  25. Hi everyone, it’s my first pay a visit at this website, and post is really fruitful
    for me, keep up posting these content.

  26. This article will assist the internet people for creating new website
    or even a blog from start to end.

    My web site King’s Quest The Silver Lining do pobrania

  27. Excellent post but I was wondering if you could write a litte more on this subject?

    I’d be very grateful if you could elaborate a little bit further.

  28. I pay a qukck visit ԁay-tⲟ-day a few blogs ɑnd sites tߋ гead articles, еxcept thіѕ blopg ɡives feature
    based content.

    Ӎʏ web-site poly auger grain hoppers

  29. Everything is very open with a precise explanation of the issues.

    It was truly informative. Your site is very helpful. Many thanks for sharing!

  30. Pretty nice post. I just stumbled upon your blog
    and wished to mention that I’ve really enjoyed browsing your weblog posts.
    After all I will be subscribing for your rss feed and I hope
    you write once more very soon!

  31. It’s going to be ending of mine day, however before ending I am reading this wonderful post to improve my experience.

  32. Diagnosing herpes among pregnant women is also important because the virus can easily be passed
    on to the fetus during delivery.

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>