본문으로 건너뛰기

<br>, <hr> Tags

br, hr Tag

Let's learn about two tags, <br> and <hr>, which are useful in controlling the flow of text and demarcating sections within an HTML document.

<br> Tag

The <br> tag stands for "line break" and is used to create a line break. It is useful when you want to start content from a new line, especially when a line break is needed within a continuous block of text.

Example:

br tag example
<p>
This is the first line.<br />
This is the second line.
</p>

This code will display the text on two lines:

This is the first line. This is the second line.

The <br> tag is an empty tag that does not require a closing tag. It can be written as <br> or <br /> for XHTML compatibility.

<hr> Tag

The <hr> tag stands for "horizontal rule" and is used to insert a horizontal line that clearly signifies the separation of content. This tag is visually used to divide major sections of a document.

Example:

hr tag example
<p>This is the content of the first section.</p>
<hr />
<p>This is the beginning of the second section's content.</p>

The horizontal line created by the <hr> tag indicates changes in topic or separation between paragraphs. This tag is also an empty tag that does not require a closing tag and can be styled using CSS.

The <br> and <hr> tags play an important role in clearly delivering the content of a web page to users. Use <br> when a line break is needed, and <hr> when you need to separate content.

다음 내용이 궁금하다면?

월 12,500원 PLUS 멤버십 가입 or 강의를 등록해 주세요!