How can I center a page with CSS?

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

This topic contains 2 replies, has 3 voices, and was last updated by  tritandominic 3 years, 8 months ago.

  • #1014


    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.