gpt4 book ai didi

css - 为 DIV 的背景着色

转载 作者:太空宇宙 更新时间:2023-11-03 18:27:18 25 4
gpt4 key购买 nike

我是 CSS 新手,希望您能帮助我。

我有一个 DIV,里面有 3 个 DIV(左 DIV、中心 DIV、右 DIV)

我可以单独放置我想要的背景(DIV by DIV),但是由于它们不在一起,它们之间存在颜色间隙。所以我试图在包含这三个的 DIV 中放置相同的背景颜色,但它不起作用。

你能帮帮我吗?

非常感谢!

HTML

<!--Divs-->
<!--<div class="cor_fundo">-->
<div class="body_resize">
<div class="left">
left
left left left left left left left left left left left left left ddddddddd</div>
<div class="center">
center
ccccccccccccccc</div>
<div class="right">
right rrrrrrrrrrrrrrrrrrrr </div>
<div class="clr"></div>
</div>
<!--</div>-->
<!--FIM - Divs-->

CSS

<!-- Divs Topo Pagina-->
.body_resize { padding:0; width:740px; margin:0 auto; background-color:#fff} -> this is the one that dont works

.right { width:130px;margin:0; padding:10px; float:right; background-color:#99CCFF}
.center {width:150px;margin:0; padding:10px; float:left; background-color:#99CCFF}
.left {width:400px;margin:0; padding:10px; float:left; background-color:#99CCFF}
<!-- FIM - Divs Topo Pagina-->

演示:http://jsfiddle.net/Iuppiter/c8dY8/

最佳答案

我已经稍微定制了你的 CSS。请看下面

HTML 结构:

<div class="body_resize">
<div class="left">left</div>
<div class="center">center</div>
<div class="right">right</div>
</div>

CSS:

.body_resize  { padding:0; width:740px; margin:0 auto; background-color:#99CCFF; display:table;} 
.right { width:130px;margin:0; padding:10px;display:table-row; float:left; }
.center {width:150px;margin:0; padding:10px;display:table-row ; float:left;}
.left {width:400px;margin:0; padding:10px; display:table-row; float:left; }

JsFiddle 链接:http://jsfiddle.net/6uXwZ/

关于css - 为 DIV 的背景着色,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/20586040/

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