html - 如何更改 <hr> 标签的粗细

标签 html css user-interface

我想在 CSS 中更改我的水平线 (<hr>) 的粗细。我知道它可以像这样在 HTML 中完成 -

<hr size="10">

但我听说这是 deprecatedMDN 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/

相关文章:

html - 使 UL 比它的父 LI 更宽

css - Safari 不显示 jssor 幻灯片图像

css - Angular Material : Can't find Typography classes

html - Mobile-Chrome 中网页底部的神秘空白

java - 应用程序打开后立即关闭

javascript - 缩小 document.getElementsByClassName 的范围是否会带来切实的性能优势?

javascript - 当我禁用提交按钮时(表单提交后)页面不加载

.net - Caliburn Micro Capture 鼠标位置

Java GUI 创建表单后调整其大小

javascript - 未捕获的不变违规 : Target container is not a DOM element