Solved

Hidden "overflow" in a table td? (urgent)

Posted on 2003-12-12
3
497 Views
Last Modified: 2010-04-09
Hi!

I have a table with two cells containing all sorts of data.
The left one has a variable content regarding height, the right one never changes.

What I want to do is to have the entire table to only use the height required by the left (variable) td. I then want the contents in the right column to "dissapear" where it runs out of pixles.

If you need a better explanation, please tell me.

Best regards,
David
0
Comment
Question by:larsan
  • 2
3 Comments
 
LVL 31

Expert Comment

by:seanpowell
ID: 9929770
Here's one way to handle this:
(Just make sure that the height spec'd in the table is "less" than the actual height of the left cell)

<table border="0" cellpadding="0" cellspacing="0" width="600">
  <tr>
    <td valign="top" height="100" width="300">123<br>
    123<br>
    123<br>
    123<br>
    123<br>
    123<br>
    123<br>
    123<br>
    123</td>
    <td valign="top" height="100" width="300">
    <div style="overflow:hidden; height:100%;">
    123<br>
    123<br>
    123<br>
    123<br>
    123<br>
    123<br>
    123<br>
    123<br>
    123<br>
    123<br>
    123</td>
  </tr>
</table>
0
 
LVL 31

Accepted Solution

by:
seanpowell earned 500 total points
ID: 9929772
Sorry - forgot the closing </div> tag...

<table border="0" cellpadding="0" cellspacing="0" width="600">
  <tr>
    <td valign="top" height="100" width="300">123<br>
    123<br>
    123<br>
    123<br>
    123<br>
    123<br>
    123<br>
    123<br>
    123</td>
    <td valign="top" height="100" width="300">
    <div style="overflow:hidden; height:100%;">
    123<br>
    123<br>
    123<br>
    123<br>
    123<br>
    123<br>
    123<br>
    123<br>
    123<br>
    123<br>
    123</div></td>
  </tr>
</table>
0
 
LVL 33

Expert Comment

by:snoyes_jw
ID: 9929993
Here's another way, which is more complicated than georgemarian's answer and requires the user to have javascript enabled and is probably browser dependent.  The only redeeming feature of my version is that you don't have to lie about td height.

<head>
<style>
.right  { overflow: hidden;}
</style>
<script language="javascript">
function doIt()
{
      var myHeight = document.getElementById("left").offsetHeight;
      document.getElementById("right").style.height = myHeight;
      document.getElementById("right").innerHTML = "Lorem ipsum dolor sit amet, consectetuer adipiscing elit, sed diam nonummy nibh euismod tincidunt ut laoreet dolore magna aliquam erat volutpat. Ut wisi enim ad minim veniam, quis nostrud exercitation ulliam corper suscipit lobortis nisl ut aliquip ex ea commodo consequat. Duis autem veleum iriure dolor in hendrerit in vulputate velit esse molestie consequat, vel willum lunombro dolore eu feugiat nulla facilisis at vero eros et accumsan et iusto odio dignissim qui blandit praesent luptatum zzril delenit augue duis dolore te feugait nulla facilisi. "
}
</script>
</head>
<body onload="doIt()">
<table id="myTable">
<tr>
      <td width="50%"><div class="left" id="left">Lorem ipsum dolor sit amet, consectetuer adipiscing elit, sed diam nonummy nibh euismod tincidunt ut laoreet dolore magna aliquam erat volutpat.</div></td>
      <td width="50%"><div class="right" id="right"></div></td>
</tr>
</table>
</body>
0

Featured Post

Master Your Team's Linux and Cloud Stack

Come see why top tech companies like Mailchimp and Media Temple use Linux Academy to build their employee training programs.

Question has a verified solution.

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

This article explains how to prepare an HTML email signature template file containing dynamic placeholders for users' Azure AD data. Furthermore, it explains how to use this file to remotely set up a department-wide email signature policy in Office …
Find out what you should include to make the best professional email signature for your organization.
In this Micro Tutorial viewers will learn how to create navigation buttons that change on rollover, using CSS (Continuation of the CSS Image Sprite tutorial) Create a parent ID for all the list items       - Specify position: absolute and display: block…
The viewer will receive an overview of the basics of CSS showing inline styles. In the head tags set up your style tags: (CODE) Reference the nav tag and set your properties.: (CODE) Set the reference for the UL element and styles for it to ensu…

770 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