gpt4 book ai didi

html - 如何设置可变宽度(带背景的 div )以使其在不同设备上看起来不错?

转载 作者:行者123 更新时间:2023-11-28 18:36:23 25 4
gpt4 key购买 nike

我正在使用 Twitter Bootstrap。这是我的问题:我需要设置 div 的背景颜色,它应该是全屏的,但是当我尝试时:

和我的 HTML:

    <div class="rowHome">
<div class="container">
<div class="row">
...
</div>
</div>
</div>

和完整的 CSS:

    .container{
width: 960px;
}
...
.rowHome{
margin-top:10px;
width:100%;
background-color:#400143;
}

当我调整页面大小时,它看起来像这样:

但是当我向右滚动时我看到了错误:

谁能告诉我我的错误在哪里?

最佳答案

这种类型的问题主要发生在parentflexible width 和他的childfixed width .在你的 CSS 中写下:

body{
min-width:960px;
}

查看更多 iPad background for div blocks not spanning entire width of screen

关于html - 如何设置可变宽度(带背景的 div )以使其在不同设备上看起来不错?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/12562753/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com