使用css的简单行不会';t有时出现在铬上

使用css的简单行不会';t有时出现在铬上,css,twitter-bootstrap,line,background-color,Css,Twitter Bootstrap,Line,Background Color,我不明白,因为有时候一条简单的颜色线不会出现在铬上。 我的行是用CSS代码定义的: /* line warning */ .line_warning { background-color:#ff9900; color:white; margin-top:5px; margin-bottom:5px; height: 1px; } 显然,我只有在chrome上才有这个问题(我使用Bootstrap) 如果您有任何解决方案,请提前向您表示感谢。一个快速解决方案是使用边框而不是背景色创建线条

我不明白,因为有时候一条简单的颜色线不会出现在铬上。 我的行是用CSS代码定义的:

/* line warning */
.line_warning {
background-color:#ff9900; 
color:white; 
margin-top:5px; 
margin-bottom:5px; 
height: 1px;
}
显然,我只有在chrome上才有这个问题(我使用Bootstrap)


如果您有任何解决方案,请提前向您表示感谢。

一个快速解决方案是使用边框而不是背景色创建线条

.line_warning {
height:0px;
    border-top:1px solid #ff9900;
    margin-top:5px; 
margin-bottom:5px;
}
我想知道是否有人能解释为什么会发生这种情况,因为这在Firefox中似乎也是一个问题

更新:我进一步研究了这一点,发现在你的身体上增加一个边距可以解决这个问题

body {  
    margin:0px;
}

这似乎就是normalize.css所使用的——不过我不知道它为什么会起作用。似乎是个bug。

用JSFIDLE编辑您的帖子,演示问题并解释在什么情况下它不会出现。