> -----Original Message-----
> From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]
> discuss.org] On Behalf Of David Laakso
> Sent: Tuesday, September 02, 2008 1:09 PM
> To: css discuss
> Subject: [css-d] attempts to center a float
> 
> Comments and suggestions?
> Thanks.
> uri:
> <http://www.chelseacreekstudio.com/ca/cssd/test-34.html>


Hi David,

For the app we work with, I have to do that quite often, but I use this
simple approach:

float:left;
width:(whatever)px;
position:relative;
left:50%;
margin-left:-(whatever/2)px;

With this technique, one can even center two floats next to each other
without the need of a wrapper.
The only issue I ran into with this so far, is that if you apply a
background image to the float then IE 6 will position the left edge of the
container in the middle of the viewport and only then will move it to the
left. If there is no background image, or if it is styling an inner element
then it's fine.


-- 
Regards,
Thierry | http://www.TJKDesign.com






______________________________________________________________________
css-discuss [EMAIL PROTECTED]
http://www.css-discuss.org/mailman/listinfo/css-d
List wiki/FAQ -- http://css-discuss.incutio.com/
List policies -- http://css-discuss.org/policies.html
Supported by evolt.org -- http://www.evolt.org/help_support_evolt/

Reply via email to