Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations derfloh on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Table Cell Height 100%

Status
Not open for further replies.

mdr227

Programmer
Nov 17, 2000
114
US
Is there a way using CSS to set the table cell height to 100%? I want a certain table cell to carry all the way down the pages in my website, but each page is a different length. I can set it for a certain number of pixels, but can't figure out how to do it at 100% (similar to how td width="100%") works.

Another question, I have been using <TD WIDTH=XX> to set my table cell width in my pages, but see from many postings that I should do that via CSS. How can I do that for the many different table cell widths that I might use throughout my site without setting up countless style tags?
 
Hello,

You can use percents in CSS dimensions... Like this:

style=&quot;width:80%;height:50%&quot;

which a believe answers your second question also. You can use style=&quot;AND PUT ANY CSS IN HERE&quot;

Have fun...



Travis Hawkins
BeachBum Software
travis@cfm2asp.com
 
For some reason I can't get that working. Here is a sample table I setup to see how I can get that to work:

<table>
<tr>
<td style=&quot;width:80%;height:50%&quot; bgcolor=&quot;red&quot;>Test1</td>
<td style=&quot;width:20%;height:50%&quot; bgcolor=&quot;blue&quot;>Test2</td>
</tr>
</table>
 
I don't know how to get just one cell to stretch to 100%, I'm not sure that's possible. But to get all <td>'s to have a certain width, declare your styles either in a separate style sheet or in the head of your html. In the head of your html, you'd put <style> tags and your style info between them:
Code:
<html>
<head>
<style>
  td{width: 55px;}
  body{background: blue;}
  ...
<style>
...
If you put your style info in a separate file, put this in the head of your html:
Code:
<link type=&quot;text/css&quot; rel=&quot;stylesheet&quot; href=&quot;style.css&quot;>
See to learn more.

Kevin
A+, Network+, MCP
 
Hey

You're right, that hardly ever works. If someone has an explanation I would love to hear it. But the way I always do that so that it stays the same accross different browsers is to create a 1x1pixel clear gif file and load it into any big blank space that I want to use and set the width/height to the size of the area. I always set the <td cells width/height as well.

-I hope it helps.


Travis Hawkins
BeachBum Software
travis@cfm2asp.com
 
I think it won't work because giving it a height of 100% means it will be 100% of the height of its container, not the entire page. Maybe you can set the table to have 100% height. Even so, it will be as tall as the window, not taller. So you may have to find another way to do what you want.

Kevin
A+, Network+, MCP
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top