<分区>
我可以看到这已经得到解答,但我已经尝试了所有的解决方案,但仍然有一个几乎看不见的 HR。
我做错了什么?
hr {
background-color: dimgrey;
color: dimgrey;
border: solid 2px dimgrey;
height: 5px;
width: 1000px;
}
<分区>
我可以看到这已经得到解答,但我已经尝试了所有的解决方案,但仍然有一个几乎看不见的 HR。
我做错了什么?
hr {
background-color: dimgrey;
color: dimgrey;
border: solid 2px dimgrey;
height: 5px;
width: 1000px;
}
最佳答案
不确定您认为几乎不可见的是什么,但 5 像素的高度非常明显。 :)
确保您在其他可能覆盖此规则的 css 之后定义此 css。
或者,使用 !important 赋予此规则优先级:
hr {
background-color: dimgrey !important;
color: dimgrey !important;
border: solid 2px dimgrey !important;
height: 5px !important;
width: 1000px !important;
}
另一种方法是为这种风格定义一个自定义类:
.bigHr {
background-color: dimgrey !important;
color: dimgrey !important;
border: solid 2px dimgrey !important;
height: 5px !important;
width: 1000px !important;
}
... 然后在需要这种样式时使用该类:
<hr class="bigHr">
关于html - 如何改变<hr>标签的粗细和颜色?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/34932679/