You are here: Re: Centering floating items « HTML « IT news, forums, messages
Re: Centering floating items

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]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация