Html 如何在html中显示彩色线条?
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/27015460/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
How display a colored line in html?
提问by lazyCat
I'm unable to use the style-color for tag "hr". Could someone help me me to display a colored line on the my jsp page using html?
我无法为标签“hr”使用样式颜色。有人可以帮助我使用 html 在我的 jsp 页面上显示一条彩色线条吗?
回答by Roi
<hr>
doesnt use color, it uses border-color
<hr>
不使用颜色,它使用 border-color
回答by nikita
You can apply border-color instead of color
您可以应用边框颜色而不是颜色
<style>
hr {
display: block;
margin-top: 0.5em;
margin-bottom: 0.5em;
margin-left: auto;
margin-right: auto;
border-style: inset;
border-width: 1px;
border-color:red;
}
</style>
回答by michael-mammut
<hr size="20" color="blue">
回答by Nelson Pires
<hr style="height:1px;border-top:1px solid #f00" />
That should do it.
那应该这样做。
回答by candied_orange
<HR COLOR="green" WIDTH="60%">
works in IE, firefox, and chrome according to my own tests and htmlgoodies
<HR COLOR="green" WIDTH="60%">
根据我自己的测试和htmlgoodies在 IE、firefox 和 chrome 中工作
If you want to add color using CSS then use border-color
as can be shown here
如果你想使用CSS添加颜色,然后使用border-color
如可以证明这里
If you want good arguments for one over the other read this dated but similar stackoverflow question.
如果你想要一个比另一个更好的论据,请阅读这个过时但类似的 stackoverflow 问题。
回答by Billy
hr:first-child{color:red;}
hr:nth-child(2){color:yellow;}
hr:last-of-type{color:blue;}
<hr><hr><hr>
回答by Shailesh Katarmal
<hr color="yellow" width="100%" >
回答by Rakesh
hr {display: block; height:1px; float:left; border-bottom:1px solid #444444; }
Use this in ur css..
在你的css中使用这个..