You are here: Re: CSS question « HTML « IT news, forums, messages
Re: CSS question

Posted by Jukka K. Korpela on 08/14/07 20:00

Scripsit DrewC:

> I am trying to position a block in my CSS and I want it to when I
> resize the browser window the margin on both sides remain the same.
> But I can only get the left side to behave this way

Set margin-left: auto and margin-right: auto. Make sure you have a
conforming doctype that puts browsers into "standards" mode, and a) accept
the fact that a fraction of old browsers don't center the block or b) use
HTML tools for centering.

Of course, you need to set a width for the block for this to work. If you
just want, say, 3em margins on both sides and the block to occupy the rest
of the available width, simply set margin-left: 3em and margin-right: 3em
(or just margin: 0 3em if it its OK to explicitly set vertical margins to
zero).

--
Jukka K. Korpela ("Yucca")
http://www.cs.tut.fi/~jkorpela/

 

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

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