用relative水平居中
超出屏幕寬度的容器想要水平居中,還是要用relative的吧?
.content{ ??????width:?1920px; ??????margin-left:?auto; ??????margin-right:?auto; ??????height:?30px; ??????box-shadow:?0?0?5px?1px?#333; ????}
.content{ ??????width:?1920px; ??????position:relative; ??????top:?0; ??????left:?50%; ??????margin-left:?-960px; ??????height:?30px; ??????box-shadow:?0?0?5px?1px?#333; ????}
雖然都是居中,但好像有明顯區(qū)別。
2016-07-13
第二段代碼中的left設(shè)為百分之50的話應(yīng)該是沒有算進(jìn)去想要居中物體本身的寬度的吧