CSS - Centering a page - then making the page 100% height

后端 未结 6 1904
名媛妹妹
名媛妹妹 2021-02-06 08:31

I\'m trying to center a page and then make it 100% in height. I have a div called \"content\" as the parent element of all elements in the HTML page. What do I need

6条回答
  •  再見小時候
    2021-02-06 09:18

    For centering the page, I typically just put the content div in the center tag, because margin-left/right:auto really doesn't work in all versions of IE.

    For making the page the whole height, you can fake it a couple of ways. My favorite is to create a background image for the body tag that is centered horizontally but tiles vertically, so that would give the main div its white background. You probably still have a footer though, so you can position it with bottom:0 and that should keep it at the bottom and give you a content div which appears to extend for the whole page.

提交回复
热议问题