Re: <option> and text-align

On 1/19/11 11:37 AM, Aharon (Vladimir) Lanin wrote:
> Now, if you say that text-align can and should control the alignment of
> an option, what should the default text-align value be for option?
> Currently, the default value is "start" for the root element, and
> inherited by all others. However, Gecko's UA default stylesheet
> specifies "start" again for <select>. Perhaps, though, that should be
> dropped, and the HTML5 default stylesheet should specify
> text-align:match-parent for <option>?

Possible.  I'm not sure how web-compatible dropping text-align styling 
on form controls might or might not be.  If my <select> is inside a 
centered <div>, it's not clear to me that I want all the stuff in the 
<select> centered, for example.  It's pretty clear to me that authors 
won't think about that, though.

> But the bigger question is whether the CSS spec can and should state
> that text-align affects <option> - since currently Firefox is alone in
> that regard.

I think a stronger statement is that Gecko is alone in using the CSS 
formatting model to handle layout of the combobox dropdown and of the 
listbox (with block boxes for options, etc, etc).

 From my testing, other UAs don't apply text-align inside a combobox 
dropdown, don't apply color styles, don't apply font-size or line-height 
or font-weight styling, etc, etc.  As in, as far as I can tell, they're 
just not using a CSS renderer to render that content.  Or they're 
rendering something totally different from the actual DOM (but note that 
styles from the <select> aren't inherited into the combobox dropdown 
either, at least in my testing).

Inside a listbox, it looks like UAs will apply some things (like color) 
but not others (like pretty much anything else I've tried).  Again, it's 
not clear to me whether the CSS formatting model is being used at all there.

-Boris

Received on Wednesday, 19 January 2011 16:51:51 UTC