<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" lang="en" xml:lang="en">
<head>
</head>
<body>
<table width="100%" cellspacing="0" cellpadding="0">
<tr>
<td align="right" colspan="5">
<span class="validationInline">*</span>
<span class="hint">Required fields</span>
</td>
</tr>
<tr>
<td colspan="5" background="http://media.monster.com.hk/bgr_8.gif">
<img src="/static/cleardot.gif" height="1" width="1" />
</td>
</tr>
</table>
</body>
</html>
Can check it out here: http://maishudi.com/tt2.html
I've known it's caused by DOCTYPE ,because deleting that part will make it normal:
http://maishudi.com/tt.html
So what's wrong?How can I make it work with the DOCTYPE ?
Note: this probably depends on the browser.
The size of block-level element (td, div, etc) if not specified will only be as big as needed, according to the space taken by its content. If specified, it will try to expand accordingly, except if the content is bigger, in which case it will expand as necessary.
In your example, the cell contains a single character (the non-breaking space), which take the size of single line. Hence, the block element must be at least 1 line-height high; it can't assume any smaller size. This is why your height declaration was ignored.
You may want to use this style:
line-height: 1px;
This sets the line-height to 1px. Line-height is not an element, so the above rule doesn't apply.
Add a style block with this rule
td img {display: block;}
and see https://developer.mozilla.org/en/Images,_Tables,_and_Mysterious_Gaps for a full explanation.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With