Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

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

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

Free Tool: ZipGrep

ZipGrep is a utility that can list and search zip (.war, .ear, .jar, etc) archives for text patterns, without the need to extract the archive's contents.

One of a set of tools we're offering as a way to say 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

Today, the web development industry is booming, and many people consider it to be their vocation. The question you may be asking yourself is – how do I become a web developer?
Originally, this post was published on Monitis Blog, you can check it here . In business circles, we sometimes hear that today is the “age of the customer.” And so it is. Thanks to the enormous advances over the past few years in consumer techno…
In this tutorial viewers will learn how to style elements, such a divs, with a "drop shadow" effect using the CSS box-shadow property Start with a normal styled element, such as a div.: In the element's style, type the box shadow property: "box-shad…
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 …

618 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