Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 3 of 3
  1. #1
    New Coder
    Join Date
    Dec 2007
    Posts
    12
    Thanks
    1
    Thanked 0 Times in 0 Posts

    center div (amateur problems)

    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,
    (www.myspace.com/3face)

    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;
    width:860px;
    z-index:1;
    overflow: visible;
    left:34px; top:175px;
    height:4581px;
    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">
    </div>

    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:

    http://www.youtube.com/watch?v=rsqJnCYFr2U

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

    Thankssss

  • #2
    Regular Coder mic2100's Avatar
    Join Date
    Feb 2006
    Location
    Scunthorpe
    Posts
    562
    Thanks
    15
    Thanked 28 Times in 27 Posts
    here is an example you should be able to see what it is doing and apply it to your needs

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

  • #3
    New Coder
    Join Date
    Dec 2007
    Posts
    12
    Thanks
    1
    Thanked 0 Times in 0 Posts
    im gonna experiment with it now!, thanks, ill let you know hos it goes and stuff

    Thanks!


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •