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. Good way of telling, and pleasant post to obtain data regarding my presentation focus, which i am going to present in university.

  2. Good way of explaining, and pleasant post to obtain data regarding my presentation topic, which i am
    going to present in academy.

  3. I see you don’t monetize your site, i think there is one opportunity to earn extra money on your
    page, search in google for- idol4jp makes money

  4. I think that everything posted made a lot of sense.

    But, think about this, what if you added a little information? I mean, I don’t wish to tell you
    how to run your blog, but what if you added something that makes people want more?
    I mean How to word-wrap long text in HTML? | Slopjong is a little vanilla.
    You could glance at Yahoo’s front page and see how they create post headlines to grab people interested.
    You might add a video or a related pic or two to grab people interested about what you’ve written. In my opinion,
    it could bring your website a little bit more interesting.

  5. 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.

  6. I read this piece of writing completely regarding the resemblance of newest and preceding technologies, it’s awesome article.

  7. Go ahead and compare the services of different auto transport
    companies and try to look for the best options as most reasonable auto transport rates, for moving
    your vehicle to another place. We offer trusted car shipping and auto transport services without a scratch.
    Hence it is always better to do some research and try to get as much information as possible for auto shipping.

  8. Important Notice: For copyright reasons I did not cowl 7 Minutes Workout Technique (to double outcomes)” as that is trademark technique and it’s
    only obtainable for the buyers of Fat Diminisher.

  9. Go ahead and compare the services of different auto
    transport companies and try to look for the best options as most reasonable auto transport rates,
    for moving your vehicle to another place. They can carry every category of vehicles to
    different places and you do not have to worry about anything.
    Hence it is always better to do some research and try to get as much information as possible for auto shipping.

  10. Estivadores, que prosseguem uma greve que
    está a condicionar fortemente as exportações, assumem tristes atitudes públicas de desrespeito em frente ao parlamento.

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

  12. I think this is amօng thee mօst vittal іnformation ffor me.

    Annd i’m glad reading уοur article.
    Ⲃut ѕhould remark on few ցeneral
    things, Τɦе site style іѕ
    ideal, tһе articles іѕ гeally
    ցreat : D. Ԍood job, cheers

    Also visit mʏ website cd player raadio fοr kids (Bernice)

  13. You actually make it appear really easy together with your presentation however I to
    find this topic to be really something which I think I’d by no means understand.
    It seems too complex and extremely broad for me.
    I am having a look ahead on your subsequent publish, I will attempt to get the grasp of it!

  14. Hello to every body, it’s my first go to see of this website; this webpage consists of amazing and really fine stuff in favor of readers.

  15. Thanks for sharing your thoughts on gaming. Regards

  16. Bajaj Auto has come up with the innovative Bajaj Pulszar 135 LS.
    On internet you wil easily get available with recently updated Yamaha FZ16 price, Yamaha FZ16reviews and access the Yamaha bikes price list.
    Advanced technology has been used to make the bike comfortable offering easy control
    and handling.

  17. I’m completely stoked about it and I’ll maintain you updated as I continue using Testo Fuel.

  18. Right away I am ready to do my breakfast, after having my breakfast
    coming again to read further news.

  19. So, which natural method would you favor to
    go for?

  20. A assortment of games you will uncover in following sites to play them on the web completely cost-free which includes puzzle games
    , action games , word games, sport, arcade, board games etc.

  21. Download FREE! Clash Royale Hack (Floy) for Android,
    iOS and Windows phone!
    Best Clash Royale Hack Tool here : !


  22. This applies to any part of life, health, environment, business, relationships, spiritual life, workplace issues, and everything else.
    Nursing and medical school loans are issued under Title VII of the Public Health Service Act and are not
    reported to the NSLDS. As a consumer you have a choice when it comes
    to buying replacement inkjet cartridges.

  23. The annual rates of herpes simplex virus type-2 infection (also
    called HSV-2) were 10.2 percent making use of tenofovir gel,
    as compared to 21 percent utilizing a placebo gel.

  24. Hi my loved one! I wish to say that this article is
    awesome, nice written and come with approximately all important infos.
    I’d like to peer extra posts like this .

  25. I do not even know the way I ended up right here, but I assumed this post was great.
    I do not recognize who you are but certainly you’re going to a well-known blogger if you happen to are not already.

  26. Hi there to every body, it’s my first pay a visit
    of this weblog; this blog carries remarkable and really fine information in support of

  27. It sounds like a good deal and many homeowners signed contracts for repairs.
    Even if you saw their ad in a respected publication, always look for references from friends, colleagues or family members for
    a firsthand account of the quality of service
    the company provides. To accomplish either repairs or new installs, a roofing contractor should
    be employed.

  28. Hi friends, how is all, and what you desire to say
    concerning this post, in my view its in fact awesome in
    favor of me.

  29. It sounds like a good deal and many homeowners signed contracts for repairs.
    Even if you saw their ad in a respected publication, always look for references from friends, colleagues or family members for

  30. I tend not to drop many remarks, however I browsed a few responses here How to word-wrap long text in HTML?
    | Slopjong. I actually do have some questions for
    you if you tend not to mind. Could it be only me or does it look
    like some of the comments appear as if they are coming from
    brain dead visitors? :-P And, if you are writing at additional social sites, I
    would like to keep up with you. Could you post a list
    of all of your social networking sites like your linkedin profile,
    Facebook page or twitter feed?

    my site free cms

  31. Have you ever considered publishing an ebook or guest authoring on other blogs?
    I have a blog centered on the same topics you discuss and would really like to have you share some stories/information. I
    know my readers would appreciate your work. If you’re even remotely interested, feel free to send me an email.

  32. Thanks for finally writing about > How to word-wrap long text
    in HTML? | Slopjong < Liked it!

  33. Wonderful post! We will be linking to this particularly great post on our website.
    Keep up the great writing.

  34. Thank you for another great post. Where else may anyone get that type of information in such an ideal way of writing?
    I have a presentation next week, and I am at the search for such

  35. Pretty nice post. I just stumbled upon your
    blog and wished to mention that I’ve really enjoyed browsing your blog posts.
    In any case I’ll be subscribing in your rss feed and I hope you write once more very soon!

  36. Wonderful beat ! I would like to apprentice whilst you amend your website,
    how could i subscribe for a blog web site? The account helped me a applicable deal.

    I have been tiny bit familiar of this your broadcast offered brilliant clear

  37. Hello mates, its great paragraph on the topic of educationand entirely explained, keep it up all the time.

  38. Every weekend i used to visit this website, because i want enjoyment,
    since this this website conations actually pleasant funny information too.

  39. I was curious if you ever considered changing the
    page layout of your site? Its very well written; I love what youve got to say.
    But maybe you could a little more in the way of content so people
    could connect with it better. Youve got an awful lot of text for only having one or 2
    pictures. Maybe you could space it out better?

  40. This is a good tip especially to those new to the blogosphere.

    Simple but very precise info… Thanks for sharing this
    one. A must read post!

  41. Quality posts is the crucial to interest the visitors to visit the site, that’s what this website is providing.

  42. It is truly a nice and helpful piece of info. I am satisfied that you just
    shared this useful info with us. Please stay
    us informed like this. Thank you for sharing.

  43. Greetings I am so glad I found your website, I really found you by accident, while I was looking on Digg for something else, Regardless I
    am here now and would just like to say thanks a lot for a tremendous post and a all round interesting
    blog (I also love the theme/design), I don’t have time to look
    over it all at the moment but I have book-marked it and also included your RSS feeds,
    so when I have time I will be back to read more, Please do keep
    up the fantastic job.

  44. Our Mission Assertion: To uphold excessive instructional
    standards through applied know-how and sensible skills within an ever-altering industry.

  45. Hi, I desire to subscribe for this weblog to take hottest updates, thus where can i
    do it please help.

  46. Amazing! Its actually awesome piece of writing, I have got much clear idea about from this piece of writing.

  47. Helpful info. Fortunate me I discovered your website
    by chance, and I am stunned why this accident did
    not took place in advance! I bookmarked it.

  48. magnificent publish, very informative. I ponder
    why the other specialists of this sector do not notice this.
    You must proceed your writing. I’m confident, you have
    a huge readers’ base already!

  49. 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.

  50. I have to thanmk you for the efforts you have put in penning this website.
    I’m hoping to check out the same high-grade blog posts by you later on as well.

    In fact, your creative writing abilities has motivated me to get my own website noow

    my web page sua binh dun sieu toc

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>