|
Posted by Els on 10/18/06 11:52
djcredo@gmail.com wrote:
> I have a rollover list which needs to be centered. I cannot use
> display:inline, because I must be able to ensure the width of each list
> item is eactly 100px. Inline doesnt let you specify width, and if you
> use margin-left and margin-right you can't be sure you are getting the
> right size because the width will depend on the number of characters in
> the list item.
>
> So I want to use "float:left" with "display:block" items. Now I can
> specify the width, but can't center the items! They all stack up on the
> left hand side.
>
> Does anyone have any solutions to this problem?
If you know the amount of items, their width (100px) and the margin
between them, put them in a container with a set width, which you then
center. What I don't understand though, is how you say "each list item
is exactly 100px", and "width will depend on the number of characters
in the list item". Seems like a contradiction.
There are ways to have blocks with set widths centered regardless of
their amount, but it does need a bit more tricky CSS. My guess is the
centered container approach will work for you though?
--
Els http://locusmeus.com/
accessible web design: http://locusoptimus.com/
Now playing: Elly & Rikkert - Het woord van onze God
Navigation:
[Reply to this message]
|