- From: Matt <matt@hogwarts-library.net>
- Date: Wed, 4 Jun 2003 20:34:24 +0100
- To: <www-style@w3.org>
Arthur Wiebe wrote: > Mikko Rantalainen wrote: > >> >> Gerard Torenvliet wrote: >> >>> I have been looking over the drafts for CSS 3.0, and they are >>> missing >>> a few >>> things that I had been hoping that I would see: >>> >>> - the ability to achieve the same effect as the text-align >>> style, but for elements like div (i.e., to have the ability to >>> set a div to a certain >>> size and then center that div in its parent) >> >> >> What's the problem with >> div { width: 55%; margin-left: auto; margin-right: auto; } >> ? >> >> The only thing I'm wondering is if text-align: justify combined >> with inline-block elements can provide me with evenly spaced >> block-like elements without using extra wrapper elements. > > It's not about what's the problem with { width: 55%; margin-left: > auto; margin-right: auto; } it is that { align: center; } would be > much > shorter and make a lot more sense to a lot more people. When I > started using CSS with XHTML 1.1 I couldn't figure out why I had to > use margins > to align tables when in HTML I could do that with align="center". > Margins should not be used for alignment. We need to be able to > type { align: center; } ! > And it should not be for tables and divisions only but also for > inline elements. That way you can center a div while the other > things on top > and under it will remain aligned to the left. > <Arthur/> But a width is necessary, else who's to know how wide the div should be? Shoudld it wrap like this or should it spread across all the available width? AFAICsee, div { margin: 0 auto; width: 60%; } is fine. After all, centring something *does* require that the margins be moved - that's what centring a block _is_! with div {align: center } how does the UI know how wide the div should be? There's width= for IMG and table, but not div and so on. Matt
Received on Wednesday, 4 June 2003 15:33:41 UTC