Forum Moderators: not2easy
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"> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> 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!
imgs 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 :)