Tutorials

KodeKite Tools

HTML
Flexbox
SVG
Canvas
HTML Tutorial

More


HTML HR Element
HR Element

Hr is empty element having no closing tag.


  • hr stands for horizontal row
  • hr is used for giving horizontal row below or top of any text
  • hr element can be closed by putting forward slash / and space after hr element

Any number of horizontal lines can be created in a page.

Syntax

<hr />
<tag>Content</tag>

or

<tag>Content</tag>
<hr />


Example


Horizontal line is at top


Note:

You can increase or decrease size of hr element and give color to it by using width, height and backgroun-color attributes respectively.

Attributes

hr has following attributes.


  • Width
  • Height
  • Backgroun-color

Example

width, height and background-color attributes of hr element



Practice Task

Open notepad or any other text editor, follow the following points.


  • Create two horizonatal lines
  • give width and height of 100 and 15 to first hr element respectively and red background-color
  • give width and height of 150 and 20 to second hr element respectively and green background-color
  • Use <br /> element if neccessary

save file with name task.html or task.htm and then open it using any browser and see results.


Solution

width, height and background-color attributes of hr element




So in this way you can give color and incease or decrease the size of hr element