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.
[Back to original message]
|