Results 1 to 2 of 2

Thread: Vertically + Horizontally Centered Layout Problem

  1. #1
    Join Date
    Nov 2007
    Posts
    9
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Question Vertically + Horizontally Centered Layout Problem

    Hi all,

    I'm trying to create a CSS layout that is both vertically and horizontally centered. I've been trying absolute positioning for the first time, however working in percentages seems to give odd results, but if I work in pixels the layout would not appear correctly in different resolutions.

    So far here is the code I've been playing around with, but I'm just getting frustrated as the numbers in pixels and percentages aren't giving (what I see as) logical displays.

    CSS
    #centrecontainer {
    position: absolute;
    top: 25%; }

    #container {
    border: 5px solid #000;
    width: 760px;
    height: 350px; }

    HTML
    <div id="centrecontainer">
    <div id="container">

    </div>
    </div>


    If anyone has any advice or knows of any tutorials in this style, I'd be grateful.

    Hopefully the answer is staring me in the face and someone can point it out for me! It's probably something to do with my lack of "absolute positioning" knowledge, but any advice is appreciated
    Last edited by Allyria; 07-23-2008 at 01:37 AM.

  2. #2
    Join Date
    Nov 2007
    Posts
    9
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default

    Ok, the answer WAS staring me in the face. I've figured it out so this thread can be removed, it doesn't seem to have been a popular one! :P

    Except I can't find the delete thread button.

    Wahh..
    Last edited by Allyria; 07-23-2008 at 01:47 AM.

Bookmarks

Posting Permissions

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