Re: Ideas for CSS 3.0?

Matt wrote:

>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
>
>
>  
>
Yes there has to be a width smaller than the parent in order for it to 
be centered. { align: center; width: 60%; } would just be better than 
having to use margins. And also align would be easier to understand. 
There is nothing wrong with margin.
Using margin is fine, it works, and that's good. But just because it 
works doesn't mean it's the best way.
In my previous examples I never thought of widths as it very obvious 
that you need a smaller width in order for something to be centered.
<Arthur/>

Received on Wednesday, 4 June 2003 16:20:41 UTC