Solved

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

Posted on 2003-12-12
3
498 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

Free Tool: SSL Checker

Scans your site and returns information about your SSL implementation and certificate. Helpful for debugging and validating your SSL configuration.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Increase the size of the modal in Bootstrap 5 42
Outlook opens HTML email as text 4 29
Call a function within the ASP code 4 19
Do alert on select 6 13
This is a PowerShell web interface I use to manage some task as a network administrator. Clicking an action button on the left frame will display a form in the middle frame to input some data in textboxes, process this data in PowerShell and display…
This article discusses four methods for overlaying images in a container on a web page
In this tutorial viewers will learn how to position overlapping items using z-index in CSS. They will also learn the restrictions on the z-index property.  Create a new HTML document with an internal stylesheet.: Create a div in CSS and name it Red.…
The viewer will learn how to create a basic form using some HTML5 and PHP for later processing. Set up your basic HTML file. Open your form tag and set the method and action attributes.: (CODE) Set up your first few inputs one for the name and …

765 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