简体   繁体   中英

CSS background DIV resizing itself while resizing the browser

Simple issue but couldn't fix it.

<div class="bg">
    <div class="container2">
        <p> Test content goes here </p>
    </div>
</div>

I have two div one is bg which has a background and second one is container.

<style>
.bg {
    background:#0C9;
}
    
.container2 {
    width:800px;
    margin:0 auto;
    text-align:center;  
}
</style>

The problem is that on resizing the browser width, the background div resizes itself from the right side.

Can anyone help to fix that?

终于修复了它,最小宽度是问题,添加到容器 div 和它的固定

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM