How can I center a page with CSS?

Home Forums Web Design How can I center a page with CSS?

  • #1014

    John
    Participant

    Pretty new to CSS, so this is problably very simple: I need the content of each and every page on my site to be centered horizontally. Been trying position absolute, but I want the page width set in percent, and that doesnt seem to work with position absolute.

    Any suggestions?

     

Viewing 2 replies - 1 through 2 (of 2 total)
  • #1015
    Mitchelle
    Participant

    I think you can use margin-left:auto;margin-right:auto; on the element you want to center.

    #1090
    tritandominic
    Participant

    You can also set your desired value, how it will fit, or widen it.

    Thanks,
    Tistan Dominic
    “Currently learning CSS at SifaGroup.com.au

Viewing 2 replies - 1 through 2 (of 2 total)
  • You must be logged in to reply to this topic.