Closed Bug 93632 Opened 23 years ago Closed 23 years ago

stylesheet doesn't get applied to empty table cells like it does to other empty elements

Categories

(Core :: Layout, defect)

x86
Windows 98
defect
Not set
normal

Tracking

()

RESOLVED DUPLICATE of bug 76775

People

(Reporter: mozilla, Assigned: karnaze)

Details

From Bugzilla Helper:
User-Agent: Mozilla/4.0 (compatible; MSIE 5.5; Windows 98)
BuildID:    2001073103

This bug can be summed up as "Empty elements that actually get displayed (have 
a width and height) should get their style displayed too, right? This is what 
DIV does, so why doesn't an empty table cell?"

If you give an empty table cell a stylesheet, some styles are not rendered. For 
instace, if you have an empty table cell with a "background-color" set, even if 
you set the cell width and height explicitly, so it should show up, the 
background color does not get displayed. Same goes for borders, etc. However, 
if I do the same with an empty div, for instance, it works, as does an empty 
table (a table with one row, one column, but nothing in that one cell).

As a side note, I noticed that if I tried the same thing in Composer, composer 
displayed it how I expected it to be displayed, even in Preview mode. This is 
probably because it assumes a table cell will always have content.

Reproducible: Always
Steps to Reproduce:
1. Save the HTML I've included below
2. View the page in Mozilla

Here is a complete HTML page to demonstrate:

<!doctype html public "-//W3C//DTD HTML 4.0 Transitional//EN">
<html><head><title>Empty Table Cell Style Display Problem</title></head>
<body>

<p>Style information gets applied to empty &lt;div&gt; element;</p>
<div style="border: thin red solid; background-color: blue; width: 40px; 
height:40px"></div>

<p>But not an empty table cell: (notice also that the empty table cell actually 
does take up space)</p>

<table><tr><td style="border: thin red solid; background-color: blue; width: 
40px; height:40px"></td></tr></table>

<p>Although if I associate the style with the table itself, it works.</p>

<table style="border: thin red solid; background-color: blue; width: 40px; 
height:40px"><tr><td></td></tr></table>

</body>
</html>

Finally, I also noticed that you get the same behavior if you use the "bgcolor" 
attribute instead of setting the background color in a stylesheet.
Duplicate of (verified/wontfix) bug 76775  -
"Color(bgcolor) is not painted in table which contains no marks."

*** This bug has been marked as a duplicate of 76775 ***
Status: UNCONFIRMED → RESOLVED
Closed: 23 years ago
Resolution: --- → DUPLICATE
You need to log in before you can comment on or make changes to this bug.