Cap'n Arbyte's
Main page

FAQ
Biography
Contact
Essays
Zany stuff
Best blog articles
Technical articles
Blog archives

Advertisements


Blogroll


Non-blog sites
(coming soon)
Friends
(coming soon)

Not A Bug :)

I figured out bug #4 from this post. It was my own fault.

The spec says that the default value of 'width' is 'auto'. This causes the margins to be set to zero:

If more than one of the three is 'auto', and one of them is 'width', then the others ('margin-left' and/or 'margin-right') will be set to zero and 'width' will get the value needed to make the sum of the seven equal to the parent's width.

So if you want to center a block element, you also need to set the 'width' to something other than 'auto':

Lookie here, a centered block element with a width 25% of its parent's!

I can't find any way to center an image (IMG isn't a block element) other than wrapping it in a block element (such as DIV) and specifying the width in the DIV.

Tiny Island