1. Advertising
    y u no do it?

    Advertising (learn more)

    Advertise virtually anything here, with CPM banner ads, CPM email ads and CPC contextual links. You can target relevant areas of the site and show ads based on geographical location of the user if you wish.

    Starts at just $1 per CPM or $0.10 per CPC.

centering a page on ie 7

Discussion in 'CSS' started by durgesh871, Jun 30, 2010.

  1. #1
    I've tried to center the page horizontally and vertically,
    and on IE6-7 the horizontal centering is not working, half of the page is being cut.

    What should I do?
     
    durgesh871, Jun 30, 2010 IP
  2. kk5st

    kk5st Prominent Member

    Messages:
    3,497
    Likes Received:
    376
    Best Answers:
    29
    Trophy Points:
    335
    #2
    kk5st, Jun 30, 2010 IP
  3. wildogre

    wildogre Well-Known Member

    Messages:
    1,018
    Likes Received:
    8
    Best Answers:
    0
    Trophy Points:
    128
    #3
    Use percentages.
     
    wildogre, Jun 30, 2010 IP
  4. Master_Seller

    Master_Seller Well-Known Member

    Messages:
    731
    Likes Received:
    15
    Best Answers:
    0
    Trophy Points:
    110
    #4
    If you want only horizontal Centering then Use margin: 0 auto; OR position: absolute; left: 50%; margin-left: -(half the width of div).

    If you want both horizontal and vertical centering then use

    position: absolute; left: 50%; top: 50%; margin-left: -(half the width of div); margin-top: -(half the height of div);

    Suppose the DIV you want to center is 400px wide and 300px in height then your css will be like this

    position: absolute; left: 50%; top: 50%; margin-left: -200px; margin-top: -150px;
     
    Master_Seller, Jun 30, 2010 IP