Closed Thread Icon

Topic awaiting preservation: Div center positioning... (Page 1 of 1) Pages that link to <a href="https://ozoneasylum.com/backlink?for=7974" title="Pages that link to Topic awaiting preservation: Div center positioning... (Page 1 of 1)" rel="nofollow" >Topic awaiting preservation: Div center positioning... <span class="small">(Page 1 of 1)</span>\

 
YoYoFREAK
Paranoid (IV) Mad Scientist

From: A lost remnant
Insane since: Jun 2001

posted posted 12-08-2001 05:57

Well I think this will be confusing to say so I will do the best I can.

I need a script that detects the browser resolutions width, divides it by two, and minuses by 172, and then writes to the left position of a div to give it it's px position to the left.

Any help would be much appreciated.
Thanks
-YoYoFREAK

Perfect Thunder
Paranoid (IV) Inmate

From: Milwaukee
Insane since: Oct 2001

posted posted 12-08-2001 06:35

If you absolutely need a special script for this, I can't help you, but I do know that you can center a div in CSS with the following:

<div style="position: absolute; left: 50%"> (left border sits in middle of viewing window)
<div style="position: absolute; left: -172px"> (corrects left border position by half of box width -- which I assume is 172px)

<!-- insert content here -->

</div></div>

I got that and many other CSS tricks from A List Apart (which in turn links to even more CSS stuff, of course).

bitdamaged
Maniac (V) Mad Scientist

From: 100101010011 <-- right about here
Insane since: Mar 2000

posted posted 12-08-2001 09:24

Lets see..

off the top of my head (which means it needs testing!)

// Get the position
x= (document.layers) ? innerWidth:document.body.offsetWidth;
x -= 172;

then the layer just needs to be positioned to the x variable.



:[ Computers let you make more mistakes faster than any other invention in human history, with the possible exceptions of handguns and tequila. ]:

YoYoFREAK
Paranoid (IV) Mad Scientist

From: A lost remnant
Insane since: Jun 2001

posted posted 12-08-2001 17:24

Thanks Bitdamaged and Perfect Thunder!
I am going to try the JS one out a bit later today, and Perfect Thunders is working good already.
Thanks for the Help!
-YoYoFREAK

« BackwardsOnwards »

Show Forum Drop Down Menu