Html <hr> 不显示

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/12639823/
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

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-08-29 03:04:41  来源:igfitidea点击:

<hr> not showing

htmlcss

提问by TeaDrinkingGeek

I have a <hr>which isn't showing.

我有一个<hr>没有显示。

HTML:

HTML:

<div id="line"><hr /></div>

CSS:

CSS:

hr {
    border: 0;
    width: 96%;
    color: #FFFF00;
    height: 1px;
}


#line {
    float: left;
    width: 731px;
    height: 10px;
}

Any ideas why it's not showing?

任何想法为什么它不显示?

回答by pkachhia

try this code :

试试这个代码:

hr {
  border: 0;
  clear:both;
  display:block;
  width: 96%;               
  background-color:#FFFF00;
  height: 1px;
}

JSFiddle link http://jsfiddle.net/EXXrB/

JSFiddle 链接http://jsfiddle.net/EXXrB/

Hope it will help you to resolve your problem.

希望它能帮助您解决您的问题。

回答by Clyde Lobo

Remove border: 0;from the css rule for hr

border: 0;从 css 规则中删除hr

Demo

演示

回答by Man Programmer

hr
{
border:solid 1px black;
width: 96%;
color: #FFFF00;
height: 1px;

}

回答by Nokia808Freak

If you intend to use border:0px;, then set height:1px;and set background:#FFFF00;
(OR)
border:1px solid #FFFF00;and height:0px;

如果您打算使用border:0px;,则设置height:1px;并设置background:#FFFF00;
(OR)
border:1px solid #FFFF00;height:0px;

That might do the trick!

这可能会奏效!

Either stick with border color to show a horizontal line or go with the background color for <HR> tag

要么坚持使用边框颜色以显示水平线,要么使用背景颜色 <HR> tag

回答by uma mahesh

Simple Way to get best Horizontal Line

获得最佳水平线的简单方法

. horizontalLine {  
    border: none; 
    border-bottom: 1px solid gainsboro;  
   }

回答by Murali Murugesan

Try this

尝试这个

hr {
border: 0;
clear:both;
display:block;
width: 96%;
color: #FFFF00;
height: 1px;
}