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

    Nice one

  2. Gaurav

    I need to display the comment
    with the same
    formate as written in the comment box

  3. slopjong

    I’m not sure if I understand you. Can you please describe with more details what you are trying to do?

  4. For the 3rd overload version Sort method, it is useful when we only need
    to sort a range of items in an Array – List. s true,
    waxing has a higher price tag of a razor or a bottle of Nair, but
    the results are smoother skin and long lasting results.
    When the discriminant is zero, the equation has exactly
    one real solution.

  5. Posst writing is also a fun, if you be familiar with then you can write if nott itt
    is complicated to write.

    For a wonderful response please checkout this site: pro muscle fit

  6. Chromecast permite disfrutar de filmin en tu televisor.

  7. A number of the suppliers conjointly provide a refund guarantee if the businesses don’t seem to be glad with their performance. One among the most effective platforms to showcase your photography skills can even be started from the comfort of your home. Professionals are already marketing themselves and their business with newsletters, brochures, press kits, Powerpoint presentations, press releases, and whatever else they can think of to make themselves known.

  8. Sehr guter Artikel! Ich sehe mir sehr gerne Serien Online an. Vorallem mag ich Netflix.

  9. Mi considero uma mulher de corpo bonito mas cheio de estrias branca e
    queria Mto acabar c elas.

  10. If some one wants to be updated with newest technologies after that he must be visit this web page and
    be up to date all the time.

  11. Thanks for sharing your thoughts on polo shirts. Regards

  12. Wherever you are in the world you can download music as long as you have a computer on hand.
    Even though it is very different from the hip-rocking and swinging music of the day, folk
    has its own place in the hearts of its lovers.

    Windows comes with a firewall built in, and this will have
    to be altered to allow for your program’s actions.

  13. Shop freshwater & saltwater fishing lures, soft
    baits, hard baits, buzzbaits, lure kits soft worm & more at kmucutie

  14. Hey very nice blog!! Guy .. Beautiful .. Superb .. I’ll bookmark your web
    site and take the feeds additionally? I am satisfied to search out a lot of useful information here in the post, we want develop extra strategies
    on this regard, thank you for sharing. . . . . .

  15. Hi Dear, are you truly visiting this web page daily,
    if so then you will absolutely obtain good know-how.

  16. Superb website you have here but I was wondering if you knew of any community forums that cover the same topics talked about here?
    I’d really love to be a part of community where I can get feed-back from other
    knowledgeable people that share the same interest. If you have any recommendations, please let me know.
    Bless you!

  17. Sleeveless hoodies appear excellent on women as nicely.
    Zumba as effectively as Aerobics are the most common makes use of even though the recognition and ways to use
    the garment increase each and every day.

  18. It’s an amazing article for all the online viewers; they will take
    advantage from it I am sure.

  19. Hi mates, how is everything, and what you want to say on the topic of
    this piece of writing, in my view its genuinely amazing designed for me.

  20. Fantastic items from you, man. I’ve be mindful your stuff previous to and you’re simply extremely magnificent.
    I really like what you have bought here, really like what you are saying and the way in which through which you assert
    it. You are making it entertaining and you still care for to stay it sensible.
    I can’t wait to learn far more from you. This is actually a wonderful website.

  21. No caso de cupcakes decorados com uma espiral de cobertura,
    pequenas decorações cortadas em pasta americana ou feitas com chocolate podem dar um
    toque diferenciado ao seu produto.

  22. obviously like your web site however you need to take a look at
    the spelling on quite a few of your posts. Several of them are rife
    with spelling issues and I find it very bothersome to tell the reality then again I will certainly come again again.

  23. Great web site. Lots of useful info here. I am sending it to
    several pals ans also sharing in delicious. And certainly,
    thanks for your effort!

  24. There is hardly any duplicate of them and they are the one and the only in promising you a healthy body with a wide smile in your cheeks.

    Some of my favorites are “Positive Attitudes, Affirmations and Actions for Overcoming YOUR Health Challenges” and “Positive Attitudes to Help Survive YOUR Cancer. However not all skinny people are healthy, but many are.

  25. Valuable info. Lucky me I found your website
    by accident, and I am shocked why this accident
    didn’t came about in advance! I bookmarked it.

  26. Massage could bring you alleviation from a variety of signs and symptoms: liquid retention, reduced back pain, headaches, swelling, sleeplessness, stretch marks and so on. Massage could likewise assist after
    the child is birthed, by realigning your pelvis and also lower back.

    My webpage massage harmony league city

  27. Buying internet media, for exampke impressions, emails distributed, sponsorships,
    sо оn. Ιt wioll bе tҺe difference
    іn thе ɑmount οf traffic, tat աill ultimately determine tһᥱ quality οf performance inside ɑ real
    business. Αt tһe minute, thhe mst popular kinds ߋf general marketing used
    Ьү advertisiing ߋn thhe internet companies іѕ called article marketing.

    Feel free tߋ surf tօ mу web ρage …

  28. Greetings I am so happy I found your webpage, I really found you
    by accident, while I was looking on Yahoo for something else, Anyways I am here now and
    would just like to say thank you for a marvelous post and a all round enjoyable blog (I also
    love the theme/design), I don’t have time to read it all at the moment but I have book-marked it and also added
    your RSS feeds, so when I have time I will be back to read more, Please do keep up the great b.

  29. Fantastic web site. Plenty of helpful info here. I’m sending it
    to a few pals ans also sharing in delicious. And certainly, thanks in your sweat!

  30. What i don’t realize is actually how you’re not really much
    more well-appreciated than you may be right
    now. You’re very intelligent. You already know thus
    significantly on the subject of this topic, produced me in my view imagine
    it from a lot of various angles. Its like women and men are not fascinated until it is something to accomplish with
    Lady gaga! Your individual stuffs nice. All the time handle it up!

  31. Howdy, і гead үour blog from time
    tօ time ɑnd і ownn а ѕimilar оne аnd і ԝaѕ ϳust wondering
    if үօu ցet ɑ ⅼot οf spam responses?

    Ӏf ѕߋ Һow ԁо youu protect
    againmst іt, anny plugin օr anything үօu сɑn advise?
    Ι ցet ѕο much ⅼately іt’s driving mme mad ѕο аny support
    іѕ ᴠery muhh appreciated.

    Ꭺlso visit mү site – vps Seo Tools

  32. Luis Junqueira, professor de Língua Portuguesa do Ensino Basic em um colégio em
    Campinas (SP), conta como desenvolveu projeto Primeiro Livro, plataforma que pretende
    ajudar alunos de escolas públicas a escreverem sua primeira publicação, a
    partir de recursos de big data.

  33. Excellent web site you’ve got here.. It’s difficult to find quality
    writing like yours nowadays. I really appreciate people like you!
    Take care!!

  34. Fine way of explaining, and good post to
    take information regarding my presentation focus,
    which i am going to deliver in institution of higher education.

  35. - This jacket is easy but trendy style. The fleece allover the hoodie makes it warm and
    it is suitable for this season.

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

  37. I blog quite often and I truly thank you for your information. This great article has really
    peaked my interest. I’m going to take a note of your blog and
    keep checking for new details about once a week. I opted in for your RSS feed too.

  38. Good article! We will be linking to this particularly great article
    on our website. Keep up the good writing.

  39. Very nice write-up. I absolutely love this website. Keep writing!

  40. I love reading a post that can make men and women think.
    Also, thank you for allowing me to comment!

  41. My brother suggested I may like this blog.
    He used to be entirely right. This post actually made
    my day. You cann’t consider simply how much time I had spent for this
    information! Thanks!

  42. Kitesurf Tarifa surfiamo da più di 10 anni di test nel dottrina del

    My webpage corsi kitesurf tarifa

  43. Thanks for your personal marvelous posting! I genuinely enjoyed reading it,
    you can be a great author.I will always bookmark your blog
    and will eventually come back later in life. I want to encourage you to definitely continue your
    great job, have a nice evening!

  44. Wow! After all I got a webpage from where I be
    capable of truly get useful data concerning my study and knowledge.

  45. Hi, after reading this amazing post i am also delighted to share my familiarity here with friends.

  46. Excellent items from you, man. I have be aware your stuff
    previous to and you are simply too fantastic.

    I actually like what you have received here, really like what you are stating and the best way during which you assert it.
    You are making it enjoyable and you continue to take care of to
    keep it sensible. I can not wait to read far more
    from you. This is really a tremendous web site.

  47. Why people still make use of to read news papers when in this
    technological world the whole thing is existing on web?

  48. Amazing! Its really amazing paragraph, I have got much clear idea regarding from this post.

    My site scottsdale recovery center (Kellee)

  49. Asking questions are truly nice thing if you are not understanding anything fully, except this piece of writing presents nice
    understanding even.

  50. Divine Gate episode 3

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>