Home > Article > Web Front-end > An ultra-wide background with a width of 1680 is placed at the bottom. How can I keep it centered?_html/css_WEB-ITnose
The css of the background:
.ckbg{ width:50%; padding-left:50%; height:578px; margin:0 auto; position:absolute; z-index:-1; background:url( images/1_bg.jpg) no-repeat;}
The display effect is that the background is always positioned relative to the upper left corner of the window.
My goal is to make the background adaptively centered. (And always at the top level)
position:absolute; is absolute positioning and has been separated from the document flow. You can delete position:absolute; and try .