Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/html/70.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/7/css/39.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Html css将颜色应用于div id和类_Html_Css - Fatal编程技术网

Html css将颜色应用于div id和类

Html css将颜色应用于div id和类,html,css,Html,Css,当我将颜色应用于divid和class时,它不起作用。请提供解决方案。我正在尝试在以下代码中为div添加颜色: html: 这里的标签颜色工作不正常 HTML: <html> <body> <div class="wrapper" > <div class="header"> <div class="logo1"></div> </div> </div> <

当我将颜色应用于divid和class时,它不起作用。请提供解决方案。我正在尝试在以下代码中为div添加颜色: html:

这里的标签颜色工作不正常

HTML:

<html>
<body>
<div class="wrapper" >
    <div class="header">    
       <div class="logo1"></div> 
    </div>
</div>
</body>
</html>
请注意,“颜色”属性只会更改文本颜色,要更改div的颜色,请使用背景色。如果你的div没有任何内容,除非你给它一个宽度/高度,否则你将看不到你的颜色

下面是一个例子:我使用了exaclty您的代码

.标题{ 填充:10px; 左边距:自动; 宽度:100%; 背景色:C60; 高度:60px; 溢出:隐藏 } .1{ 颜色:0F0;/**这只会更改文本颜色**/ 溢出:自动 } 标志
请共享您的HTML和一个工作提琴或代码笔。背景颜色:0F0;你想要的不是颜色:@user这是你想要的吗?我已经在评论中提到了,似乎这不是答案
<html>
<body>
<div class="wrapper" >
    <div class="header">    
       <div class="logo1"></div> 
    </div>
</div>
</body>
</html>