Closed. This question is off-topic。它当前不接受答案。
                            
                        
                    
                
                            
                                
                
                        
                            
                        
                    
                        
                            想改善这个问题吗? Update the question,所以它是on-topic,用于堆栈溢出。
                        
                        在11个月前关闭。
                                                                                            
                
        
我的html代码如下。我在Chrome和Firefox上都进行了测试。在两个浏览器中,第一个div的背景色均不起作用。



.box-orange {
  // without any position declaration
  background: orange;
  height: 100px;
  width: 100px;
  border: 1px solid blue;
}

.box-red {
  background: green;
  height: 100px;
  width: 100px;
  border: 1px solid red;
}

<html>

<head>
</head>

<body>
  <div class="box-orange"></div>
  <div class="box-red"></div>
</body>

</html>





谁能告诉我问题在哪里?

最佳答案

删除注释,它是引起错误的原因
CSS代码中的注释应该像这样/*your comment*/

10-05 20:25
查看更多