This week's book giveaway is in the Servlets forum.
We're giving away four copies of Murach's Java Servlets and JSP and have Joel Murach on-line!
See this thread for details.
The moose likes HTML, CSS and JavaScript and the fly likes div not wrapping words Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of Murach's Java Servlets and JSP this week in the Servlets forum!
JavaRanch » Java Forums » Engineering » HTML, CSS and JavaScript
Bookmark "div not wrapping words" Watch "div not wrapping words" New topic

div not wrapping words

Michele Smith
Ranch Hand

Joined: Oct 27, 2010
Posts: 412

the above referenced code is not wrapping in the div content 2.

This is with HTML 5.0.

Also I have tried this:

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; /* IE */

Chetan Charadva

Joined: Dec 05, 2008
Posts: 5
Use "clear: left" for "content2" div.
Michele Smith
Ranch Hand

Joined: Oct 27, 2010
Posts: 412
Thanks I got rid of the floats and this did the same thing.

Thanks anyway for your advice, it is appreciated.

Thanks, Michele
Bear Bibeault
Author and ninkuma

Joined: Jan 10, 2002
Posts: 60765

It wraps fine for me when I drop that fragment into an HTML page. There must be something else applying styles to the element. I suggest loading the page into Chrome (or Forefox with Firebug) and open the dev tools to inspect the computed CSS that is applied to the element.

P.S. Applying lots of styles with the style attribute is not recommended. You should be applying those styles though a stylesheet.

[Asking smart questions] [Bear's FrontMan] [About Bear] [Books by Bear]
Michele Smith
Ranch Hand

Joined: Oct 27, 2010
Posts: 412
Thanks Bear! Appreciated very much,

I agree. Here's the link:
subject: div not wrapping words
Similar Threads
Social media integration
CSS Alignment Doubt
Verticaly Align 3 Column DIV in IE6
jQuery drag and drop of divs
Float problem