?
Solved

html table and moving cell sizes

Posted on 2010-11-26
8
Medium Priority
?
171 Views
Last Modified: 2012-05-10
i am using ie and trying to make up a grid like excel but when you enter in the data if its longer than the cell then the cell will expand. what i want to do is to have the cell grow in height to make the adjustment instead of in width. the data is being returned via ajax and will have many
differing characer count as the data is returned

$ret.='<table>';
<td width="152" style="width:152">'.$nyz'</td>
<td width="152" style="width:152">'.$123.'</td>
<td width="152" style="width:152">'.$abv.'</td>
<td width="152" style="width:152">'.$xyz.'</td>';
            
$ret.='</table>'; data layup
0
Comment
Question by:sydneyguy
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
  • 2
  • 2
  • +1
8 Comments
 
LVL 18

Accepted Solution

by:
Sudaraka Wijesinghe earned 668 total points
ID: 34220975
If you have continuous string in the TD, you won't be able stop it from expanding. You can add a DIV tag in the TD and set a fixed width to that and set overflow to hidden. (extra text will be cut off from the display)

Btw, Add TR tags around the TDs.

Found this here http://www.experts-exchange.com/Web_Development/Web_Languages-Standards/HTML/Q_21605705.html
<td><div style="width:152px; overflow;hidden;">'.$nyz'</div></td>

Open in new window

0
 
LVL 84

Assisted Solution

by:Dave Baldwin
Dave Baldwin earned 668 total points
ID: 34220987
If you're trying to get all the sections to line up together, you need to make it One table and not a bunch of little ones.  If it's One table, then all of the columns will have the same width from top to bottom.  Start the table at the top, loop thru your data, and end the table after the loop.  Like below:
echo '<table>';
///
while(...) {
$ret.='<tr>';
$ret.='<td width="152" style="width:152">'.$nyz'</td>
<td width="152" style="width:152">'.$123.'</td>
<td width="152" style="width:152">'.$abv.'</td>
<td width="152" style="width:152">'.$xyz.'</td>';            
$ret.='</tr>'; 
}
echo '</table>';

Open in new window

0
 
LVL 84

Expert Comment

by:Dave Baldwin
ID: 34220990
This would be better.
echo '<table>';
///
while(...) {
$ret = '<tr>';
$ret.='<td width="152" style="width:152">'.$nyz'</td>
<td width="152" style="width:152">'.$123.'</td>
<td width="152" style="width:152">'.$abv.'</td>
<td width="152" style="width:152">'.$xyz.'</td>';            
$ret.='</tr>'; 
echo $ret;
}
echo '</table>';

Open in new window

0
What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

 
LVL 13

Assisted Solution

by:gbanik
gbanik earned 664 total points
ID: 34222764
Just echo this before the body
echo '<STYLE>td {width:152px;vertical-align:top}</STYLE>';
and create your table and columns without any width.

If you are filling data by AJAX, it may be better to use DIVs rather than TABLEs and TDs.
0
 
LVL 13

Expert Comment

by:gbanik
ID: 34222772
and of course do what DaveBaldwin suggested... create ONE table rather than many small ones. Data within cells (cell widths) are restricted by column widths across all rows of the table.
0
 

Author Comment

by:sydneyguy
ID: 34223494
thanks for that am playing with a sample file now so will know by the end of the day. when we have it going.
welcome to a fantastic sunday every one,
0
 

Author Closing Comment

by:sydneyguy
ID: 34398829
thanks for the help rebuit the lay out and now works fine
have a good christmas and a good new year
0
 
LVL 18

Expert Comment

by:Sudaraka Wijesinghe
ID: 34399250
Glad to help. Thanks for the points.
0

Featured Post

Concerto's Cloud Advisory Services

Want to avoid the missteps to gaining all the benefits of the cloud? Learn more about the different assessment options from our Cloud Advisory team.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Nothing in an HTTP request can be trusted, including HTTP headers and form data.  A form token is a tool that can be used to guard against request forgeries (CSRF).  This article shows an improved approach to form tokens, making it more difficult to…
A quick Powershell script I wrote to find old program installations and check versions of a specific file across the network.
In this tutorial viewers will learn how to embed Flash content in a webpage using HTML5. Ensure your DOCTYPE declaration is set to HTML5: "<!DOCTYPE html>": Use the <object> tag to embed Flash content.: To specify that the object is Flash content, d…
The viewer will learn the basics of jQuery including how to code hide show and toggles. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery…
Suggested Courses

718 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question