我想在 CSS 中更改我的水平线 (<hr>
) 的粗细。我知道它可以像这样在 HTML 中完成 -
<hr size="10">
但我听说这是 deprecated如 MDN here 中所述.在 CSS 中,我尝试使用 height:1px
但它不会改变厚度。我想要 <hr>
行是 0.5px
厚的。
我在 Ubuntu 上使用 Firefox 3.6.11
最佳答案
为保持一致性,删除所有边框并使用 <hr>
的高度厚度。添加背景颜色将为您的 <hr>
设置样式指定高度和颜色。
在您的样式表中:
hr {
border: none;
height: 1px;
/* Set the hr color */
color: #333; /* old IE */
background-color: #333; /* Modern Browsers */
}
或者你有它的内联:
<hr style="height:1px;border:none;color:#333;background-color:#333;" />
更多解释here
关于html - 如何更改 <hr> 标签的粗细,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/4151743/