jovhenni19
jovhenni19

Reputation: 450

word wrap on html paragraph

I have a paragraph tag inside a table, and for example it has a text like this...

4: asldkflaksdjflks, lasjdlfjsaldfjasldjfoajsdkfjaslkdjlkfasjdfwoidjfalk,zmncv,mznoqeworjoiejflaksdlfjwaf

How can the text wrap something like this..

4: asldkflaksdjflks, lasjdlfjsaldfjasldjfoajsdkfjaslkdjlkfasj
dfwoidjfalk,zmncv,mznoqeworjoiejflaksdlfjwaf

I have tried word-wrap:break-word; but it doesn't seem to work. I'm using IE8

Here is my css:

#notes table tr td p{
    font-family:Arial;
    padding:2% 2% 2% 5%;
    table-layout: fixed;
    word-wrap: break-word;

Update 1

I was wrong with my question. Sorry about that. I want the text not to wrap, even though there is a white-space. But it will go down to the next line if necessary. Hope that I'm clearer this time.

Is there a character that looks like a space, but doesn't serve as a breakpoint for the word wrap?

Upvotes: 1

Views: 7798

Answers (3)

user827080
user827080

Reputation:

  is an HTML non-breaking space. Is that what you're looking for?

Upvotes: 1

SamStar
SamStar

Reputation: 335

You could put your text into a <pre> tag, and put the <pre> tag in you <p> tag. A <pre> allows you to control text wrapping within the html. If the <p> collapses to the size of the <pre>, then set a width on the <p>. Does that help?

Upvotes: 2

adriantoine
adriantoine

Reputation: 2217

As explained here : http://www.css3files.com/text/#wordwrap the word-wrap property is not compatible with IE8.

I think it's impossible to do this on IE8 with simple HTML and CSS, you will have to do it in javascript.

EDIT: It seems that there's finally a solution for that : word-wrap:break-word not working in IE8

Upvotes: 0

Related Questions