I need someone to explain to me where this extra padding is coming from on divs that contain img elements.
You can go to http://www.dev12.com/CSSTest for live examples of my two problems.
Problem #1: Safari, Firefox and Opera render roughly 6 pixels of unwanted bottom padding on the container div. It does not matter if I explicitly set padding to 0px.
Problem #2: If I format my code so that each image is on it's own line in my html file, an additional 6 pixels of right padding are added to each image. For example, the following code block renders unwanted padding between the two images:
<div>
<span><img src="button.gif" /></span>
<span><img src="button.gif" /></span>
</div>
However, this code block does not have the unwanted space:
<div>
<span><img src="button.gif" /></span><span><img src="button.gif" /></span>
</div>
Obviously Safari, Firefox and Opera are rendering my carriage return between span tags as whitespace. I cannot recall ever having this problem before. I am writing my code in Textmate. Is there a setting I should look at to prevent this?
I always use the XHTML 1.0 Strict doctype. This is particularly confusing to me because it is so rudimentary. Somebody help me understand this!
KN