CSS背景颜色不工作 [英] CSS background color not working

查看:91
本文介绍了CSS背景颜色不工作的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我将外部div的背景颜色设置为蓝色,但不显示。为什么?

I set the background color of the outer div to blue but it is not displayed. Why?

CSS

.question-template {
    width: auto;
    height: auto;
    background-color: blue;
}
.question {
    float: left;
    margin: 10px;
}
.participants {
    background-color: green;
    float: left;
    margin: 10px;
}​

HTML

<body>
<div class="question-template">
    <div class="participants">234</div>
    <div class="question">Some lorem ipsum text</div>
</div>
</body>

它的演示 http://jsfiddle.net/4zjtp/

推荐答案

/ p>

Try like this..

.question-template {
    width: auto;
    height: auto;
    background-color: blue;
    overflow:auto;
}

这篇关于CSS背景颜色不工作的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆