Re: Alignment property proposal

On Nov 6, 2007, at 7:30 AM, Jens Meiert wrote:

>> Allow centering of content within a containing block.
> It sounds like you mean something like the "auto" value [1] of the  
> "margin" property?
>> ' alignment'
>> Value:          left |center | right | inherit
> Like "margin: auto" equaling "alignment: center"?
> [1] 
> visudet.html#Computing_widths_and_margins
> -- 
> Jens Meiert

Sometimes designers like to think in terms of how much space to use  
on either side of an object. For this, "margin" is perfect. It can be  
set to "auto" to keep the object in the middle, or it can accept  
fixed values (e.g., "12px" or "0.5in") or percentages.

However, sometimes designers think in terms of positioning and  

"Alignment: center" would correspond with "margin: auto". There is  
clearly a correspondence between the two, the real difference is in  
the way the user thinks of the problem. I would like to see both  
"margin" and "alignment" included in CSS and that would allow the  
user to think about the problem in whichever terms he/she wants.

This proposal lacks a little of being able to fulfill that  
correspondence. There is no way to align objects vertically or both  
vertically and horizontally within a block. There is also no  
consideration of the possibility that a user might want the aligned  
block fixed ("2.54cm") or relative ("20%"). Since the two ways of  
considering layout (margins and alignment) correspond, there is  
little extra effort in allowing both, the main coding (actual layout)  
would be in a single place and probably already exists; only the  
front end (the user interface, the CSS parsing, whatever you want to  
call it) would be added.

What about:

align, align-horizontal, align-vertical: start | end | center | auto  
| {fixed-units} | {percentages}

Align-horizontal and align-vertical accept one or two values. Start,  
end, and center would be a single value, related to the direction of  
block layout flow and would place the aligned object at the obvious  
place within the block. Either one or two of the auto, {fixed-units},  
or {percentages} would be allowed. The first one would apply to the  
start of the block and the second one would apply to the end.  
Disambiguating and constraining rules similar to those for "margin"  
would be applied if the aligned block were too small or too large to  
fit within the alignment requests.

Align accepts one, two, three, or four values, relating to horizontal  
and vertical alignment. I'm not sure of the best order, only that it  
might be nice to have a shorthand, similar to margin.

If I'm using the wrong terminology, I apologize. {fixed-units} are  
like px, cm, in. Do we also want to allow em, ex, and so on?

There are more details to decide on, but I don't want to write a  
novel unless there is interest. I can fill out this proposal a little  
more if someone asks for it.

James Elmore

Received on Tuesday, 6 November 2007 16:15:38 UTC