FAQsHTML and CSS Frequently Asked Questions
"For People Who Make Mistakes" ...
DIV to Center Squares
Q: I just also took note from your May 30 'Little Squares' post, that you put the IMGs in their own DIV. What does that buy you? I want to understand more of this stuff.
A:The div is a container for the three images. I used it to center the images. That's all.
1. Images in a Div
2. Images not in a Div
One could use the paragraph tag or other block level tags to center the three squares but I like the way the <div align="center"> behaves.
<div align="center">images go here...</div>
Another way, the more purist method I think, is to use <div style="margin:0px auto;">. But that doesn't work in every browser, particularly in one older browser that I use. Your mileage may vary.
<div style="margin:0px auto;">images go here...</div>
