File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes HTML, CSS and JavaScript and the fly likes wrapping issue Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of REST with Spring (video course) this week in the Spring forum!
JavaRanch » Java Forums » Engineering » HTML, CSS and JavaScript
Bookmark "wrapping issue" Watch "wrapping issue" New topic

wrapping issue

prajwala solanki

Joined: Jul 17, 2007
Posts: 9
I have a problem with the wrap..
one of my <td> width is 150....but the content is like a big string without any spaces in between... so I wraped the content....but the cell width was expanding.. Here I am attaching the code just copy it and run...for your clear idea i used background colors..wrapping works fine but cell expanding??/

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "">
<html xmlns="">
<script type="text/javascript">
function toggleSection( secid )
var sectionId = document.getElementById(secid);
if (sectionId == null) return;
if ( == '')
{ = 'none';
} else { = '';
function toggleCoaCmt( cmtId )
toggleSection('max_' + cmtId);
toggleSection('min_' + cmtId);
<form id="form1">
<table width="950" border="0" cellpadding="0" cellspacing="1" >

<tr bgcolor="#E0E0E0">
<td> </td>
<td width="225" bgcolor="#E0E0E0" class="datacellhead3" style="width:225px;word-wrap:break-word" wrap>
test COA 3 (achoy2 19-Oct-2007 at 00:14:27 EDT)
<div id="coa_rpt_cmt_6" class="comment"></div>
<td width="25" bgcolor="#E0E0E0" class="datacell">hello</td>
<td width="80" bgcolor="#E0E0E0" class="datacell">01-Dec-2008</td>
<td width="80" bgcolor="#E0E0E0" class="datacell"></td>
<td width="90" bgcolor="#E0E0E0" class="datacell">Demonstrator</td>
<td width="70" bgcolor="#E0E0E0" class="datacell">Recommended: Not Required</td>
<td width="150" bgcolor="red" class="comment" wrap>
<div id="max_Status_1" style="float:left;background-color:yellow;word-wrap:break-word;width:150px">
<a href="javascript:toggleCoaCmt('Status_1')" >[+]</a>
<div id="min_Status_1" style="float:left;display:none;background-color:yellow;word-wrap:break-word;width:150px">
<a href="javascript:toggleCoaCmt('Status_1')" >[-]</a>
testing123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890 (abcd1 19-Oct-2007 at 00:17:21 EDT) test (abcd1 19-Oct-2007 at 00:14:27 EDT)
<td width="10" align="center" bgcolor="#E0E0E0" class="datacell">3</td>
<td width="50" bgcolor="#E0E0E0" class="datacell" style="word-wrap:break-word">Melbourne</td>
<td width="50" bgcolor="#E0E0E0" class="datacell">Vehicles Sales</td>
<td width="50" bgcolor="#E0E0E0" class="datacell"></td>
<td colspan="12" bgcolor="#E0E0E0"> </td>
Eric Pascarello

Joined: Nov 08, 2001
Posts: 15385
When you specify a width, you need to include units.

prajwala solanki

Joined: Jul 17, 2007
Posts: 9
means .... like width="150px"
i tried that one also....can you please run the code...and see the problem where its occuring ...because i am not so good in this alignment...with my knowledge i tried maximum possibilities...

when you click [+] link you will see the cell expansion....
prajwala solanki

Joined: Jul 17, 2007
Posts: 9
Is there any possible way to fix width of a specific cell(mean i want to fix width of 6th column only) that i can fix this problem...
I agree. Here's the link:
subject: wrapping issue
It's not a secret anymore!