Horizontally align elements? Well, float usually suits my purposes for left or right-aligning objects, and you can use "margin: auto" (or "margin: 0 auto" or "margin-left: auto; margin-right: auto") to horizontally center elements (though I'm not sure what happens when you combine floats and this kind of margin setting. . .)
What does XHTML have against tables and frames? It's not XHTML, but end-users (because of browsers) actually. Tables are good, but they make a page take a long time to load, especially if you have a lot of images. Regarding frames, I have nothing against them personally, but they are bad for accessibility, such as screen readers. Also, many people use text browsers rather than graphical browsers, so the page looks odd because frames are not implemented in many text browsers.
This might be one way to prevent the problem that you describe: enclose the floating divs within a div which has an explicit width. That will force the browser to show a scrollbar when the page width is reduced too much. That should stop the floating images from stacking. There are some disadvantages to this method too, so see if it works for you.
Tracy Dryden
Meddle not in the affairs of dragons,
For you are crunchy, and good with mustard.
You could also use the overflow property on the body (or the page container if you have a page container). This also works well, though it can cause some headaches if not used properly (I can't think of any problems right now. . .)
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.