DEMO 1: margin: auto实现


.demo_div_1 {
    background: orange;
}
.demo_wrapper {
    max-width: 900px;
    margin: auto;
}

        

Hi I am demo

mzk

DEMO 2: calc+padding 实现


.demo_div_2 {
    background: orange;
    padding: 0 calc(50% - 450px)
}

        

Hi I am demo

mzk