SitePoint Sponsor

User Tag List

Results 1 to 6 of 6
  1. #1
    SitePoint Member
    Join Date
    Feb 2002
    Posts
    4
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Having a difficult time centering something.

    Any help on this issue would be appreciated

    I'm trying to center something on a page and I (think) I have everythign done correctly but it won't center properly. In dreamweaver it is showing as being aligned in the center, but on the web it is aligning to the left side. Anyone know how I may be able to go about fixing this?

    http://209.160.41.75/vdj/vdj.php

  2. #2
    SitePoint Wizard silver trophy
    Join Date
    Mar 2006
    Posts
    6,132
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    html controls how your browser displays a webpage. so this is an html question, not a php question.

    please use the html forum
    http://www.sitepoint.com/forums/forumdisplay.php?f=52 (i know its kinda hidden)

  3. #3
    The CSS Clinic is open silver trophybronze trophy
    Paul O'B's Avatar
    Join Date
    Jan 2003
    Location
    Hampshire UK
    Posts
    40,376
    Mentioned
    180 Post(s)
    Tagged
    6 Thread(s)
    Your link isn't working so I can't give any advice except look at the css faq on how to center a page with css. If that doesn't solve your problem then post some code or a valid link

  4. #4
    SitePoint Member
    Join Date
    Jul 2006
    Location
    Dublin & Dundalk
    Posts
    9
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    to centre (using css, as this is the css forum) just bang it all in a div and give it the property
    Code:
    #containingdiv {
    margin: 0px auto;
    }
    This will centre the div on the page, and be flush with the top of the containing div (or the body tag) as 'auto' allows the margin to stretch fully either side, centring the div.

  5. #5
    Non-Member Egor's Avatar
    Join Date
    Jan 2004
    Location
    Melbourne, Australia
    Posts
    7,305
    Mentioned
    1 Post(s)
    Tagged
    1 Thread(s)
    Quote Originally Posted by clamcrusher
    html controls how your browser displays a webpage. so this is an html question, not a php question.
    No html describes the content. CSS controls the display.

  6. #6
    The CSS Clinic is open silver trophybronze trophy
    Paul O'B's Avatar
    Join Date
    Jan 2003
    Location
    Hampshire UK
    Posts
    40,376
    Mentioned
    180 Post(s)
    Tagged
    6 Thread(s)
    Quote Originally Posted by spudmurf2k
    to centre (using css, as this is the css forum) just bang it all in a div and give it the property

    Code:
    #containingdiv {margin: 0px auto;}

    While you are in essence correct you should note that in order to center something with that method the element must have a defined width.

    Also note that the above method wont work in ie6 in quirks mode or in ie5 and 5.5 (in any mode) as they don't understand margin:auto and require text-align:center on a parent instead.

    This is explained in the faq and why i recommended reading there first


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
  •