html - 声明内联时 css 不工作

标签 html css

这是我的html和css

<html>
  <style type='text/css'>
    .rtop *, .rbottom *{
      display:block;
      height:1px;                  
      overflow:hidden;
    }
  </style>
 <link rel='StyleSheet' href='roundedCorner.css' type='text/css'>
 <body>

   <div id='abhishek1'>
     <div style='width:200px;height:5px;'>    
       <b class='rtop' >
         <b class='r1_top' style='background-color:#6e99d4 '> </b> </br>  
         <b class='r2_top' style='background-color:#6e99d4'> </b>  </br>
         <b class='r3_top' style='background-color:#6e99d4'> </b>  </br>
         <b class='r4_top' style='background-color:#6e99d4'> </b>  </br>
       </b></br>
     </div>
    </div>
  </body>
</html>

如果我从 .rtop 中删除 display:block 并将其作为内联样式放置,它不会产生相同的结果,但我不知道为什么。

最佳答案

因为最有可能的是,你把它放在了错误的元素中,或者忘记用分号结束某些东西。 请注意,在 head 中,它不适用于 rtop 和 rbottom,但适用于它们的子元素,因此您必须将它放在每个 r1_ r2_ 等元素中。

关于html - 声明内联时 css 不工作,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/22478754/

相关文章:

javascript - 谷歌在请求外部文件的离线/本地主机应用程序中美化

html - 水平居中标志和 li 元素

asp.net - 在 asp.net 中打印报告

java - 用 Java 解析 CSS

javascript - Hide::before 悬停在事件元素上

javascript - 动态创建链接并在同一 iframe 中打开它

css - 如何使用 Big Cartel 隐藏菜单

javascript - 根据CSS中 parent 的高度使 child 居中

javascript - 如何在不破坏现有 HTML 的情况下更改 DOM 中的所有文本?

html - 图像不是很灵敏