On 7/5/06, Eoin Maguire <[EMAIL PROTECTED]> wrote:
> I'm trying to center a couple of select boxes within a div that has a
> background image. However, I don't want everything within the div centered,
> only the select elements.
>
> I've tried text-align: center and also setting the margin: 0 auto. But
> neither work. What's the easiest to center a specific element within another
> div?

Hi, Eoin,

Text alignment can only be applied to block elements, table cells, and
inline-blocks[1], not replaced inline elements (such as select boxes).
Likewise, using auto margins also only works on block elements[2], not
inline elements[3].

The only way to reliably center an item such as this is to wrap it in
its own block element, then either apply text-align:center or auto
margins on the block.

Sorry for the bad news!

Michael

[1] http://www.w3.org/TR/CSS21/text.html#alignment-prop
[2] http://www.w3.org/TR/CSS21/visudet.html#blockwidth
[3] http://www.w3.org/TR/CSS21/visudet.html#inline-replaced-width
______________________________________________________________________
css-discuss [EMAIL PROTECTED]
http://www.css-discuss.org/mailman/listinfo/css-d
IE7b2 testing hub -- http://css-discuss.incutio.com/?page=IE7
List wiki/FAQ -- http://css-discuss.incutio.com/
Supported by evolt.org -- http://www.evolt.org/help_support_evolt/

Reply via email to