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.

The best and most proper way to center in css?

Discussion in 'HTML & Website Design' started by vinogradov, Apr 5, 2010.

  1. #1
    I know of the hacky ways to center css (like the negative margin-left trick) and others, but what is the proper way?

    What position should I be using? relative?
     
    vinogradov, Apr 5, 2010 IP
  2. HellBomb

    HellBomb Active Member

    Messages:
    125
    Likes Received:
    2
    Best Answers:
    0
    Trophy Points:
    80
  3. dabzo

    dabzo Peon

    Messages:
    188
    Likes Received:
    1
    Best Answers:
    0
    Trophy Points:
    0
    #3
    The hackey one is GREAT... for absolutes and fixed positioning.

    Other than that a combination of margin: 0 auto; and (for ie) a wrapper div that has text-align:center;

    Will keep everything where it should be and is a very common convention.

    [​IMG]
     
    Last edited: Apr 5, 2010
    dabzo, Apr 5, 2010 IP