Jump to content

WTF, DOCTYPE?


justsomeguy

Recommended Posts

I was pulling my hair out over this for a while until I decided to try changing the doctype. Can anyone explain why this behavior occurs in Opera or Firefox:http://manchine.net/w3/loose.htmlhttp://manchine.net/w3/strict.htmlI had several images on the page, and all of them had 4 pixels padding underneath them. Some were links, some weren't. Why are the browsers compelled to add 4 pixels underneath the images if the doctype is strict? Am I missing something?

Link to comment
Share on other sites

I seem to recall Skemcin mentioning something like this once, and it has to do with the tables, not the images. Try putting a line break after the images.

<tr><td><a href="home.php" style="display: block;"><img src="images/home.gif" alt="Home" onmouseover="this.src='images/home_over.gif';" onmouseout="this.src='images/home.gif';"></a><br /></td></tr>
Link to comment
Share on other sites

Actually, I put the table there as a test after everything else wasn't working. I originally just had 7 images in a single td, but added the nested table to try and force it. I'll minimize the code and see what I can do, I'm also nearly positive I tried display: block on the images. I know I tried it on the anchors, I'll try it on the images as well.

Link to comment
Share on other sites

Alright, I updated the examples online. It looks like the display: block on the images did the trick, I guess I didn't try that one. Adding the br didn't do anything, I did try that one. I updated online with that as well.So.. if an image is displayed inline, under strict, it gets a margin under it? That's the rule? What if you want an inline image with no margin?

Link to comment
Share on other sites

No, I added that on there as well. Padding too. The three different versions on the pages include a table on top with br tags at the end, then a div with block-level <a> elements and no margin or padding, then a div with block-level <img> elements. I stripped the javascript on the last two as well.

Link to comment
Share on other sites

That's a good looking menu, but a little overkill for this situation. I don't even want or need the table (I removed it on the examples), I was just trying to use the table to try and force the positioning. All I wanted was 7 images on top of each other with no margins between them. Setting the images to be block elements removed the margin.

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...