CSS Div 背景颜色中的“无效属性值”

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/15645196/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-08-29 22:12:01  来源:igfitidea点击:

'Invalid property value' in Div background-color

csstwitter-bootstrap

提问by naio

I use one of Bootstrap examples: http://twitter.github.com/bootstrap/examples/fluid.html

我使用 Bootstrap 示例之一:http: //twitter.github.com/bootstrap/examples/fluid.html

The following code is inserted into the navbar-inner div:

以下代码插入到导航栏内部 div 中:

    <div class="logo">
        <div class="quadratLogo">&nbsp;</div>
    </div>

Styled as:

样式为:

    .logo {
      font-size: 24px;
      font-family: 'Arial';
      min-width: 500px;
    }

    .quadratLogo {
        width:24px;
        height:20px;
        border-radius:0px 4px 0px 4px;
        background-color: ff0000;
        float:left;
    }

Can you tell why quadratLogo div is invisible and the background-color property of quadratLogo is seen as unvalid by Chrome?

你能说出为什么quadratLogo div是不可见的并且quadratLogo的背景颜色属性被Chrome视为无效吗?

回答by adrift

That's a valid color - but you forgot to include a #symbol before the hex value.

这是一种有效的颜色 - 但您忘记#在十六进制值之前包含一个符号。

.quadratLogo {
     width:24px;
     height:20px;
     border-radius:0px 4px 0px 4px;
     background-color: #ff0000;
            /* --------^ */
}

回答by huMpty duMpty

Your background-colorproperty is incorrect.

你的background-color属性不正确。

it should be background-color: #ff0000;or set the proper color name

它应该是background-color: #ff0000;或设置正确的颜色名称

Read more about background-color

阅读有关背景颜色的更多信息