21 of 133 menu

The hr tag

The hr tag sets a horizontal dividing line. The advantage of the tag is that in order to draw a single line, you do not need to create extra blocks. Does not require a closing tag.

Example

Let's see how the hr tag works:

<hr>

:

Example

Let's try to change the color of the line using the CSS property border-color:

<hr style="border-color: red;">

:

Example

The line color can also be changed using the color property (in this case, if the color and border-color properties are set simultaneously, the second one has priority):

<hr style="color: red">

:

Example

Now let's change the color of the line using the CSS property border. Note that this will make the line double in thickness (since we set the border both at the top and bottom):

<hr style="border: 1px solid red;">

:

Example

Let's try to change the color of the line using the CSS property border-top, and set only the top border. Now there will be no double line:

<hr style="border-top: 1px solid red;">

:

Example

Let's make a line in the form of dots using the CSS property border-top, set the value to dotted instead of solid:

<hr style="border-top: 1px dotted red;">

:

Example

Let's increase the line width using the CSS property border-width:

<hr style="border-width: 10px; border-color: red;">

:

Example

Now let's add a height of height to the line and a border of border. The border will then split into an upper and lower border:

<hr style="height: 10px; border: 1px solid red;">

:

See also

  • tag br,
    which sets the line break
byenru