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

Posted by cwdjrxyz on 02/17/06 20:40

H. Mäki wrote:
> Can I center div-tag somehow if I want to define div width in pixels?
>
> If I define left, right and width in percents it works, but then I can't
> define minimum width? (what "min-width" does anyway?)

This likely can be done if you do not mind using javascript, but be
aware that a small number of browsers have script turned off. I will
outline what is involved below. In case you are interested, I likely
can find one of my pages that uses it.

Script can be written to detect the screen width.Then the division is
written using a document.write which uses absolute positioning for the
division and the detected screen width. The needed absolute left
position for the division is calculated using script by division of the
detected screen width by 2 to detect the screen width center, and then
by subtraction of 1/2 of the desired division width.

 

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

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