View Full Version : center div (amateur problems)

12-20-2007, 08:36 PM
hey people!,

hope everyones good,

please bare with me, im a noob when it comes to HTML coding and i need desperate help,

BASICALLY, im working on a friends myspace and almost finished,

now what i want to know is how to horizontally center a div i made (not the contents of the div the actual div)

the code of the div I have is:

<div class="Main">
<div style="position: absolute;
overflow: visible;
left:34px; top:175px;
visibility: visible;
background-color: transparent;">
<img src="http://i25.photobucket.com/albums/c99/3face/topbannercut.jpg"> <img src="http://i25.photobucket.com/albums/c99/3face/Room-p2.jpg"> <img src="http://i25.photobucket.com/albums/c99/3face/navbar-p3.jpg"> <img src="http://i25.photobucket.com/albums/c99/3face/biomusic-p4.jpg"> <img src="http://i25.photobucket.com/albums/c99/3face/blogs-p5.jpg"> <img src="http://i25.photobucket.com/albums/c99/3face/friends-p6.jpg"> <img src="http://i25.photobucket.com/albums/c99/3face/rest-p7.jpg">

The reason I want to center it is because as you can see, it is absolutely positioned and i believe this causes problems when dragging the window on a mac as it stays in the same place where as the background behind the div accomodates itself to fit nicely on the window. If oyur confused by what I mean, my friend made this video to explain what im talking about:


please could someone shed light on this for me, i would appreciate it soo much.


12-20-2007, 08:53 PM
here is an example you should be able to see what it is doing and apply it to your needs

<div style="left:40&#37;; right:40%; width:20%; height:100%; background:#000099; position:absolute;"></div>

hope it help

12-20-2007, 09:29 PM
im gonna experiment with it now!, thanks, ill let you know hos it goes and stuff