100% height of a div inside a TD

100% height of a div inside a TD

Post by Lamberti F » Mon, 29 Aug 2005 18:45:07


This is a multi-part message in MIME format.


I've got the problem described in the table above.

I've put a div red with some text inside a TD, but its height is less than 100% of TD height as you can see.

I've defined the following styles:

div.test { background-color:red; height:100%; width: 100%; }
table.test { border: 1px solid #CCCCCC; background-color:yellow; }
td.test { border: 1px solid #CCCCCC; }

does anyone know a solution ?

Please help me.

Regards to all

2
2b 1
4 5
7 8

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML><HEAD>
<META http-equiv=Content-Type content="text/html; charset=iso-8859-1">
<META content="MSHTML 6.00.2800.1515" name=GENERATOR>
<STYLE></STYLE>
</HEAD>
<BODY><FONT face=Arial><FONT size=2>
<DIV>
<STYLE>
div.test {
background-color:red;
height:100%;
width: 100%;
}

span.test {
background-color:blue;
height:100%;
width:100%;
}
</STYLE>
 I've got the problem described in the table above.</DIV>
<DIV> </DIV>
<DIV>I've put a div red with some text inside a TD, but its height is less than
100% of TD height as you can see.</DIV>
<DIV> </DIV>
<DIV>I've defined the following styles:</DIV>
<DIV> </DIV>
<DIV>div.test { background-color:red; height:100%; width: 100%; } </DIV>
<DIV>table.test { border: 1px solid #CCCCCC; background-color:yellow; } </DIV>
<DIV>td.test { border: 1px solid #CCCCCC; }</DIV>
<DIV> </DIV>
<DIV>does anyone know a solution ?</DIV>
<DIV> </DIV>
<DIV>Please help me.</DIV>
<DIV> </DIV>
<DIV>Regards to all</DIV>
<DIV> </DIV>
<DIV>
<STYLE>
div.test {
background-color:red;
height:100%;
width: 100%;
}

span.test {
background-color:blue;
height:100%;
width:100%;
}
table.test {
border: 1px solid #CCCCCC;
background-color:yellow;
}
td.test {
border: 1px solid #CCCCCC;
}
</STYLE>
 
<STYLE>
div.test {
background-color:red;
height:100%;
width: 100%;
}

span.test {
background-color:blue;
height:100%;
width:100%;
}
table.test {
border: 1px solid #CCCCCC;
background-color:yellow;
}
td.test {
border: 1px solid #CCCCCC;
}
</STYLE>

<TABLE class=test id=Table1 cellSpacing=0 cellPadding=0 width=300 border=0>
<TBODY>
<TR>
<TD class=test>2<BR>2b</TD>
<TD class=test>
<DIV class=test>1</DIV></TD></TR>
<TR>
<TD class=test>4</TD>
<TD class=test>5</TD></TR>
<TR>
<TD class=test>7</TD>
<TD class=test>8</TD></TR></TBODY></TABLE></DIV></FONT></FONT></BODY></HTML>
 
 
 

100% height of a div inside a TD

Post by McKiraha » Tue, 30 Aug 2005 01:14:38

his is a multi-part message in MIME format.



"Lamberti Fabrizio" < XXXX@XXXXX.COM > wrote in message news:DIfQe.111047$ XXXX@XXXXX.COM ...
I've got the problem described in the table above.

I've put a div red with some text inside a TD, but its height is less than 100% of TD height as you can see.

I've defined the following styles:

div.test { background-color:red; height:100%; width: 100%; }
table.test { border: 1px solid #CCCCCC; background-color:yellow; }
td.test { border: 1px solid #CCCCCC; }

does anyone know a solution ?

Please help me.

Regards to all

2
2b 1
4 5
7 8


Change
<TD class=test><DIV class=test>1</DIV></TD>
to
<TD class=test><DIV class=test>1<br> </DIV></TD>

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML><HEAD>
<META http-equiv=Content-Type content="text/html; charset=iso-8859-1">
<META content="MSHTML 5.50.4937.800" name=GENERATOR>
<STYLE></STYLE>
</HEAD>
<BODY bgColor=#ffffff>
<DIV><FONT face=Arial size=2></FONT> </DIV>
<BLOCKQUOTE dir=ltr
style="PADDING-RIGHT: 0px; PADDING-LEFT: 5px; MARGIN-LEFT: 5px; BORDER-LEFT: #000000 2px solid; MARGIN-RIGHT: 0px">
<DIV>"Lamberti Fabrizio" <<A
href="mailto: XXXX@XXXXX.COM "> XXXX@XXXXX.COM </A>> wrote in
message <A
href="news:DIfQe.111047$ XXXX@XXXXX.COM ">news:DIfQe.111047$ XXXX@XXXXX.COM </A>...</DIV><FONT
face=Arial><FONT size=2>
<DIV>
<STYLE>
div.test {
background-color:red;
height:100%;
width: 100%;
}

span.test {
background-color:blue;
height:100%;
width:100%;
}
</STYLE>
 I've got the problem described in the table above.</DIV>
<DIV> </DIV>
<DIV>I've put a div red with some text inside a TD, but its height is less
than 100% of TD height as you can see.</DIV>
<DIV> </DIV>
<DIV>I've defined the following styles:</DIV>
<DIV> </DIV>
<DIV>div.test { background-color:red; height:100%; width: 100%; } </DIV>
<DIV>table.test { border: 1px solid #CCCCCC; background-color:yellow; } </DIV>
<DIV>td.test { border: 1px solid #CCCCCC; }</DIV>
<DIV> </DIV>
<DIV>does anyone know a solution ?</DIV>
<DIV> </DIV>
<DIV>Please help me.</DIV>
<DIV> </DIV>
<DIV>Regards to all</DIV>
<DIV> </DIV>
<DIV>
<STYLE>
div.test {
background-color:red;
height:100%;
width: 100%;
}

span.test {
background-color:blue;
height:100%;
width:100%;
}
table.test {
border: 1px solid #CCCCCC;
background-color:yellow;
}
td.test {
border: 1px solid #CCCCCC;
}
</STYLE>
 
<STYLE>
div.test {
background-color:red;
height:100%;
width: 100%;
}

span.test {
background-color:blue;
height:100%;
width:100%;
}
table.test {
border: 1px solid #CCCCCC;
background-color:yellow;
}
td.test {
border: 1px solid #CCCCCC;
}
</STYLE>

<TABLE class=test id=Table1 cellSpacing=0 cellPadding=0 width=300 border=0>

 
 
 

100% height of a div inside a TD

Post by Lamberti F » Tue, 30 Aug 2005 07:22:55

his is a multi-part message in MIME format.


I can't use your solution, because the table is compiled runtime and so I can't know before the maximum lenght of 1 td for setting the correct width style.
"McKirahan" < XXXX@XXXXX.COM > wrote in message news: XXXX@XXXXX.COM ...

"Lamberti Fabrizio" < XXXX@XXXXX.COM > wrote in message news:DIfQe.111047$ XXXX@XXXXX.COM ...
I've got the problem described in the table above.

I've put a div red with some text inside a TD, but its height is less than 100% of TD height as you can see.

I've defined the following styles:

div.test { background-color:red; height:100%; width: 100%; }
table.test { border: 1px solid #CCCCCC; background-color:yellow; }
td.test { border: 1px solid #CCCCCC; }

does anyone know a solution ?

Please help me.

Regards to all

2
2b 1
4 5
7 8


Change
<TD class=test><DIV class=test>1</DIV></TD>
to
<TD class=test><DIV class=test>1<br> </DIV></TD>

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML><HEAD>
<META http-equiv=Content-Type content="text/html; charset=iso-8859-1">
<META content="MSHTML 6.00.2800.1515" name=GENERATOR>
<STYLE></STYLE>
</HEAD>
<BODY bgColor=#ffffff>
<DIV><FONT face=Arial size=2>I can't use your solution, because the table is
compiled runtime and so I can't know before the maximum lenght of 1 td for
setting the correct width style.</FONT></DIV>
<BLOCKQUOTE dir=ltr
style="PADDING-RIGHT: 0px; PADDING-LEFT: 5px; MARGIN-LEFT: 5px; BORDER-LEFT: #000000 2px solid; MARGIN-RIGHT: 0px">
<DIV>"McKirahan" <<A
href="mailto: XXXX@XXXXX.COM "> XXXX@XXXXX.COM </A>> wrote in message
<A
href="news: XXXX@XXXXX.COM ">news: XXXX@XXXXX.COM </A>...</DIV>
<DIV><FONT face=Arial size=2></FONT> </DIV>
<BLOCKQUOTE dir=ltr
style="PADDING-RIGHT: 0px; PADDING-LEFT: 5px; MARGIN-LEFT: 5px; BORDER-LEFT: #000000 2px solid; MARGIN-RIGHT: 0px">
<DIV>"Lamberti Fabrizio" <<A
href="mailto: XXXX@XXXXX.COM "> XXXX@XXXXX.COM </A>> wrote
in message <A
href="news:DIfQe.111047$ XXXX@XXXXX.COM ">news:DIfQe.111047$ XXXX@XXXXX.COM </A>...</DIV><FONT
face=Arial><FONT size=2>
<DIV>
<STYLE>
div.test {
background-color:red;
height:100%;
width: 100%;
}

span.test {
background-color:blue;
height:100%;
width:100%;
}
</STYLE>
 I've got the problem described in the table above.</DIV>
<DIV> </DIV>
<DIV>I've put a div red with some text inside a TD, but its height is less
than 100% of TD height as you can see.</DIV>
<DIV> </DIV>
<DIV>I've defined the following styles:</DIV>
<DIV> </DIV>
<DIV>div.test { background-color:red; height:100%; width: 100%; } </DIV>
<DIV>table.test { border: 1px solid #CCCCCC; background-color:yellow; }
</DIV>
<DIV>td.test { border: 1px solid #CCCCCC; }</DIV>
<DIV> </DIV>
<DIV>does anyone know a solution ?</DIV>
 
 
 

100% height of a div inside a TD

Post by Dave Ander » Wed, 31 Aug 2005 02:07:30


I would start by fixing your validation problems, especially the improper
nesting ones:

line 8 column 24 - Warning: missing </font> before <div>
line 8 column 7 - Warning: missing </font> before <div>
line 10 column 1 - Warning: inserting implicit <font>
line 10 column 1 - Warning: inserting implicit <font>
line 10 column 1 - Warning: missing </font> before <style>
line 10 column 1 - Warning: <style> isn't allowed in <font> elements
line 40 column 1 - Warning: <style> isn't allowed in <div> elements
line 40 column 1 - Warning: <style> isn't allowed in <div> elements
line 94 column 53 - Warning: discarding unexpected </font>
line 94 column 60 - Warning: discarding unexpected </font>
line 3 column 7 - Warning: inserting missing 'title' element
line 6 column 1 - Warning: <style> inserting "type" attribute
line 10 column 1 - Warning: <style> inserting "type" attribute
line 41 column 1 - Warning: <style> inserting "type" attribute
line 62 column 1 - Warning: <style> inserting "type" attribute
line 6 column 1 - Warning: t *** empty <style>
line 8 column 24 - Warning: t *** empty <font>
line 8 column 7 - Warning: t *** empty <font>

Then get all of the garbage out. You don't need three instances of the same
style rules. When all is said and done, there is a simple solution. Here is
a complete document that does what you want (and validates):



<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<html>
<head>
<title>Test</title>
<style type="text/css">
table {
width: 300px;
border-collapse: collapse;
border: 1px solid #ccc;
background-color: #ff0;
}
td {
border: 1px solid #ccc;
height: 100%;
}
td div {
background-color: #f00;
height: 100%;
}
</style>
</head>
<body>
<table>
<tr><td>2<br>2b</td>
<td><div>1</div></td></tr>
<tr><td>4</td>
<td>5</td></tr>
<tr><td>7</td>
<td>8</td></tr>
</table>
</body>
</html>



--
Dave Anderson

Unsolicited commercial email will be read at a cost of $500 per message. Use
of this email address implies consent to these terms. Please do not contact
me directly or ask me to contact you directly for assistance. If your
question is worth asking, it's worth posting.
 
 
 

100% height of a div inside a TD

Post by V2lsbGlhbS » Sun, 04 Sep 2005 03:46:38

You can try setting the font size of the enclosing TD to 0px...