这是我的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/