html - problem with word wrapping
I have some text in div, and I want it to wrap to fit document width (without any scrolls!). I don't want to have word-break, like div {word-wrap: break-word;}
For example (this is what I want to get):
hello world! today is a
good day.
But not:
hello world! today is a good day.
or:
hello world! today i开发者_如何转开发s a go
od day.
I'm not sure what you want, is it just this?
<div style="width:200px">hello world! today is a good day.</div>
Maybe the <wbr>
tag could help you.
This tag allow the browser to insert a line break where it's positioned,
"if the browser want" .
This is a page were the IEbreak behavior is documented, you can take It as a model to do some debugging.
And if you want to fire-up jQuery to script-inject <wbr>
in your html here you can se an example from John Resig.
You can read a complete reference about It here
A similar topic was discussed on SO here.
精彩评论