Forum Moderators: not2easy

Message Too Old, No Replies

Space gaps appear between vertical images if using strict.dtd

but it won't appear if it's loose.dtd

         

urbanzen

5:08 am on Nov 6, 2006 (gmt 0)

10+ Year Member



Hello Webmasterworld,

I'm seeing strange behaviors on some experimental codes below while using xhtml strict and transitional loose. All margins and paddings are set to zero for the test examples below. Tested both settings with 1pixel border and no border. Same effect.


<div><img src="asdf"></div>
<div><img src="fdsa"></div>

...or ...

<img src="asdf"><br /><img src="fdsa">

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN"
"http://www.w3.org/TR/REC-html40/loose.dtd">

For the above declaration, the vertical images are stacked. No spaces appear in between, either with or without borders.

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">

This is the declaration that shows about a 5 pixel gap with the pseudo code. Even on non-xhtml, strict declaration there also appears the exact height gaps.

Why is this it, from the W3C standpoint? If the I replace the <img...> tags with text, then there are no gaps in between.

This quirk appears for both Mozilla and IE.

Thanks in advance for your view on this topic!

Setek

5:36 am on Nov 6, 2006 (gmt 0)

10+ Year Member



img
s have a bit of space below them due to the fact that they have a
vertical-align
of
baseline
.

You can fix the whitespace gap with

vertical-align: bottom;
if you want to be in strict mode.

I didn't realise it as I always use a strict doctype, but I suppose being a transitional doctype the rules are a little lax :)

swa66

5:25 pm on Nov 6, 2006 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Strict mode shouldn't do the quirks to be compatible with the old days and as such puts images on a text line, the space you see if for the descenders of characters like y, g etc.