What is the correct way to do a CSS Wrapper?

后端 未结 9 2120
后悔当初
后悔当初 2020-12-07 12:45

I have heard a lot of my friends talk about using wrappers in CSS to center the \"main\" part of a website.

Is this the best way to accomplish this? What is best pra

9条回答
  •  南方客
    南方客 (楼主)
    2020-12-07 13:21

    Are there other ways?

    Negative margins were also used for horizontal (and vertical!) centering but there are quite a few drawbacks when you resize the window browser: no window slider; the content can't be seen anymore if the size of the window browser is too small.
    No surprise as it uses absolute positioning, a beast never completely tamed!

    Example: http://bluerobot.com/web/css/center2.html

    So that was only FYI as you asked for it, margin: 0 auto; is a better solution.

提交回复
热议问题