Forum Moderators: not2easy

Message Too Old, No Replies

text wrap in div - please help

         

lyndalouise

2:14 pm on Jan 14, 2005 (gmt 0)

10+ Year Member



I have a div which is inside an html table cell. I want the div to take up 100% of the cell and not to extend the cell's width. Instead I would like the text to wrap to the next line. However the text is currently just getting chopped off at the end of each line (as in overflow:hidden). I have tried overflow, word-break, white-spcae and various other things but nothing works. Please help!

#content {text-align: justify;
background: #daecfe;
padding: 20px;
border: 4px solid #ffffff;
font-size: smaller;
width: 100%;
height: 100%;}

CaseyRyan

2:16 pm on Jan 14, 2005 (gmt 0)

10+ Year Member



Do you have cellpadding and cellspacing set to 0 in the table attributes?

-=casey=-

lyndalouise

2:19 pm on Jan 14, 2005 (gmt 0)

10+ Year Member



Yes, both are set to 0

lyndalouise

2:24 pm on Jan 14, 2005 (gmt 0)

10+ Year Member



if it helps the site I am working on is here so you can see the problem

[edited by: rogerd at 2:44 pm (utc) on Jan. 14, 2005]
[edit reason] No specifics/URLs, please... [/edit]

Longhaired Genius

2:32 pm on Jan 14, 2005 (gmt 0)

10+ Year Member



Delete "width: 100%;" it's not necessary because the default behaviour of a div is to take up the available lateral space, and it's what's causing the problem in this case because of issues arising from the "css box model".

lyndalouise

2:35 pm on Jan 14, 2005 (gmt 0)

10+ Year Member



The problem did only arise when I added width:100% but I only added this in an attempt to solve another problem - even though the code is the same across the site, on some pages the text was pushing the box outsite of the table causing a vertical scrollbar and it didn't match up correctly with the table rows above and below. Would you be able to help with this problem?

Longhaired Genius

2:49 pm on Jan 14, 2005 (gmt 0)

10+ Year Member



Do you mean a horizontal scrollbar? Is the problem caused by very long words or URLs? If your code validates and works well otherwise, maybe it's not worrying about if it happens only on a couple of pages.

lyndalouise

2:57 pm on Jan 14, 2005 (gmt 0)

10+ Year Member



The horizontal scroll bars do only appear on a couple of pages. All of the pages appear fine on my computer, it is on my collegues that they appear, yet we are using exactly the same browsers etc. There are no long words or urls, the pages that this happens on appear to be fairly random. I have now removed the 100% as this didn't solve the original problem anyway!

Longhaired Genius

3:12 pm on Jan 14, 2005 (gmt 0)

10+ Year Member



Sorry, I don't know what else could be causing this.