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

An ultra-wide background with a width of 1680 is placed at the bottom. How can I keep it centered?_html/css_WEB-ITnose

WBOY
WBOYOriginal
2016-06-24 12:16:33901browse

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)


Reply to the discussion (solution)

position:absolute; is absolute positioning and has been separated from the document flow. You can delete position:absolute; and try .

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn