HTML-Line breaks, Horizontal Lines and preformatted text in HTML(HTML-8)


                                               

HTML provides several ways to format text on a webpage. In this post, we'll explore three important formatting elements in HTML: line breaks, horizontal lines, and preformatted text.

Line Breaks

A line break is a special character used to break a line of text and start a new one. In HTML, you can use the "<br>" tag to insert a line break. Here's an example(W-1-1)

(W-1-1)

Note that in the above example, the text inside the "<p>" tag is treated as a single paragraph, but the line break<br> tag creates a visual break between the two lines.

Horizontal Lines

A horizontal line is a visual divider that can be used to separate different sections of a webpage. In HTML, you can use the "<hr>" tag to insert a horizontal line. Here's an example(W-1-2)

     
(W-1-2)

Note that in the above example, the "<hr>" tag creates a horizontal line that spans the width of the page.


Preformatted Text

Preformatted text is displayed in a fixed-width font and preserves whitespace, line breaks, and other formatting exactly as it appears in the HTML code.

In HTML, you can use the "<pre>" tag to display preformatted text. Here's an example(W-1-3)

(W-1-3)


Note that the text inside the "<pre>" tag is displayed in a fixed-width font and preserves all formatting.


Conclusion

In conclusion, line breaks, horizontal lines, and preformatted text are important formatting elements in HTML that can help you create well-organized and visually appealing web pages. By using these elements, you can make your content more readable and easier to understand.


Post a Comment

أحدث أقدم
LightBlog
LightBlog