[Okta Webinar] Learn how to a build a cloud-first strategyRegister Now

x
?
Solved

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

Posted on 2003-12-12
3
Medium Priority
?
505 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 2000 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

Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

Question has a verified solution.

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

Not sure what the best email signature size is? Are you worried about email signature image size? Follow this best practice guide.
Finding original email is quite difficult due to their duplicates. From this article, you will come to know why multiple duplicates of same emails appear and how to delete duplicate emails from Outlook securely and instantly while vital emails remai…
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…
In this tutorial viewers will learn how to embed videos in a webpage using HTML5. Ensure your DOCTYPE declaration is set to HTML5: "<!DOCTYPE html>": Use the <video> tag to insert a video. Define the src as the URL of your video; this is similar to …
Suggested Courses

834 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