Click to See Complete Forum and Search --> : screen size / centering an image noob question


whil
07-08-2003, 03:12 PM
Hi :)
I'm new to java script, and just converted everything to css after a long long time of having my site up. But I am currently trying to center an image / table under another table.

I have
<table style="z-index: -1; left: monkeys; top: 10px; position: absolute;"
where monkeys is a variable holding the value of
(screen.width - 800) / 2.

How do i have the left value have the value held in monkeys?
I have tried to return the value with a function and call it from
<table style="z-index: -1; left: <script type="text/javascript">myfunction()</javascript>; top: 10px; position: absolute;"
but that also did not work.

Can ne one help me out?

Thanks,
Whil :)

pyro
07-08-2003, 04:41 PM
If you are just trying to center horizontally, margin: auto should do the trick (you may also need text-align: center, for buggy browsers [think IE]).