• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Preserve word wrap and line breaks

 
Greenhorn
Posts: 5
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi, I don't know if anyone here can help me on this one,

Basically I've got a page reading in text from a database.

Now there are problems that I've been encountering with white space.
I've made a section in my CSS to combat this problem which is now fine in firefox. Internet Explorer seems to be the problem.

putting in -
word-wrap: break-word; preserves line breaks in the text being read in, however this option doesn't wrap the text to the cell it's being put in.

white-space: normal; wraps the text to the cell but doesn't preserve line breaks.

I can only seem to use one of these options at a time so I'm abit stuck for ideas really. Does anyone know anything about this or a fix for it?

Thanks!
[ February 10, 2008: Message edited by: Bear Bibeault ]
 
Tom Wake
Greenhorn
Posts: 5
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Oh I was just wondering why this had been edited? I'm new here and hope I'm complying with your rules.

Hope someone can help me!
 
Sheriff
Posts: 67746
173
Mac Mac OS X IntelliJ IDE jQuery TypeScript Java iOS
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
It'd be helpful if you could provide a code snippet that clearly shows the issues. Make it the smallest snippet that exhibits the problem and be sure to use UBB code tags to preserve formatting (read this for more information).

With regards to editing, your subject line was probably adjusted. I usually do this when it's excessively long, contains all uppercase, isn't clear or on topic, or has excessive punctuation.

You might also want to include the text snippet you're trying to display.
 
Sheriff
Posts: 13411
Firefox Browser VI Editor Redhat
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Tom,
Welcome to Javaranch.

Other than our naming policy and our most important rule (Be Nice) there really aren't any rules that you could have broken.
I may have been that the moderator who edited your post saw a way to tweak your question to improve its chances of being answered.

We've compiled a page of tips, here.

Good luck with your question.

-Ben


[clunk]
[ February 10, 2008: Message edited by: Ben Souther ]
 
Tom Wake
Greenhorn
Posts: 5
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi guys,

Thank you for your quick responses.

Basically my CSS class is -



The code that reads in from the database is -


The pre codes in the class are fine for firefox and include line breaks in the text being read in and wrap the text within the cell.

The break-all is for IE, break word includes line breaks but doesn't wrap the text. If I use break-word it wraps the text within the cell but doesn't include line breaks.

Also, using <pre> </pre> tags intead of my css class doesn't seem to wrap the text in either browser.

Any ideas?
[ February 11, 2008: Message edited by: Tom Wake ]
 
author
Posts: 15385
6
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Replace the breaks in the database with the <br/> tag.

Eric
 
Tom Wake
Greenhorn
Posts: 5
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi Eric,

Thanks for the suggestion. I have the problem that users of the website are able to submit News articles to the database and I'm sure that not everyone will remember to use code in their articles.

Is there a way to automatically convert line breaks to the html code?
 
Author
Posts: 43
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Sure: how about:



'HTH
 
Tom Wake
Greenhorn
Posts: 5
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thanks very much will give this a try
 
A lot of people cry when they cut onions. The trick is not to form an emotional bond. This tiny ad told me:
a bit of art, as a gift, the permaculture playing cards
https://gardener-gift.com
reply
    Bookmark Topic Watch Topic
  • New Topic