Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How can I change the thickness of my <hr> tag

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"> 

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.

I am using Firefox 3.6.11 on Ubuntu

like image 919
Srikar Appalaraju Avatar asked Nov 11 '10 05:11

Srikar Appalaraju


People also ask

How do you change the thickness of the HR line?

If you want to change the thickness, or height of your horizontal line, add the height property to your <hr> style. In this case, you can also set the background-color property for the thick horizontal line.

Which attribute of HR tag is used to change the thickness of line?

Size: The thickness of the horizontal line can be changed with the size attribute.


1 Answers

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.

In your stylesheet:

hr {     border: none;     height: 1px;     /* Set the hr color */     color: #333; /* old IE */     background-color: #333; /* Modern Browsers */ } 

Or inline as you have it:

<hr style="height:1px;border:none;color:#333;background-color:#333;" /> 

Longer explanation here

like image 178
Gregg B Avatar answered Sep 19 '22 15:09

Gregg B