473,410 Members | 1,872 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,410 software developers and data experts.

100% height of a div inside a TD

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

Aug 28 '05 #1
3 6608

"Lamberti Fabrizio" <la***@quipo.it._cut_off> wrote in message news:DI*********************@news4.tin.it...
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>&nbsp;</DIV></TD>

Aug 28 '05 #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.
"McKirahan" <Ne**@McKirahan.com> wrote in message news:YY********************@comcast.com...

"Lamberti Fabrizio" <la***@quipo.it._cut_off> wrote in message news:DI*********************@news4.tin.it...
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>&nbsp;</DIV></TD>

Aug 28 '05 #3
Lamberti Fabrizio wrote:
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 ?


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: trimming empty <style>
line 8 column 24 - Warning: trimming empty <font>
line 8 column 7 - Warning: trimming 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.
Aug 29 '05 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

5
by: Duane Lambe | last post by:
On some suggestions from this group, I've started to turn my internal helpdesky site for our company to non-absolute positioning. I've been reading O'Reilly's CSS book, and several web sites and...
11
by: Not4u | last post by:
Hello, I have a problem with CSS code. I want to have one menu column with a fixed width and a 100% height and the rest of the page for content. ---------------- |.|.|<--100%-->|...
3
by: Raghavendra | last post by:
Hi All, Here is my code. ------------------------------------------- <div style="height:100%"> <BODY> sample text spanning about 30 lines </BODY> </div>...
6
by: jslaybaugh | last post by:
I'm working on an ASP.NET 2.0 application and am having trouble with a very simple table layout. Using ASP.NET 2.0 it defaults to XHTML 1.0 Transitional and I am trying to comply. However, I...
2
by: Jeremy Chapman | last post by:
If my page has a doc type tag of: <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> How do I create a div that sizes it's...
4
by: reycri | last post by:
I have a page that works as I intend in IE but not in Firefox: <html> <head> <title>Overflow Test</title> </head> <body style='overflow:hidden; margin:0; padding:0;'> <table border='0'...
11
by: yawnmoth | last post by:
How do you get both of these div's to have a 100% width? (1): <div style="float: left; background: black; color: white">Hello, world! </div> <div style="clear: both; background: blue; color:...
4
by: fjm | last post by:
Hello everyone, I have a question regarding css where I would like to know if it is possible to break up a page into thirds for the height. I need to have a page that will be 100% in height and...
6
by: msoliver | last post by:
I'm trying to figure out why the following creates a vertical scroll bar. Browser is IE 7 - using XHTML 1.0. I expand html and body to height of 100% and then I want to put a border around the...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.