如何更改< hr>的厚度标签
问题描述:
我想在CSS中更改水平尺(<hr>
)的厚度.我知道可以像这样用HTML完成-
I want to change the thickness of my horizontal rule (<hr>
)in CSS. I know it can be done in HTML like so -
<hr size="10">
但是我听说已弃用为在此处的MDN 中提到.在CSS中,我尝试使用height:1px
,但它不会更改厚度.我希望<hr>
行宽为0.5px
.
But I hear that this is deprecated as mentioned on MDN here. In CSS I tried using height:1px
but it does not change the thickness. I want the <hr>
line to be 0.5px
thick.
我在Ubuntu上使用Firefox 3.6.11
I am using Firefox 3.6.11 on Ubuntu
答
为保持一致性,请删除所有边框,并使用高度作为<hr>
厚度.添加背景色将使用指定的高度和颜色为您的<hr>
设置样式.
For consistency remove any borders and use the height for the <hr>
thickness. Adding a background color will style your <hr>
with the height and color specified.
在样式表中:
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;" />
更长的解释此处