Previous task
Text markup with HTML9/10
Back to the list of tasks
  1. 1. Paragraphs
  2. 2. Headings and subheadings
  3. 3. Unordered list
  4. 4. Ordered list
  5. 5. Multilevel list
  6. 6. Description List
  7. 7. Strong and b tags
  8. 8. Em and i tags
  9. 9. Line breaks and separators
  10. 10. Preformatted text
Nest task
  • Courses
  • Sign up
  • Log in

Loading...
It will be ready in a few seconds.

  • Theory
  • Theory

Line breaks and separators

Sometimes you may need to insert a line break into your text without creating a paragraph. For example, when marking up poems or song lyrics.

HTML provides a single <br> tag for this purpose.

Sometimes this tag is used to break text into "sort of paragraphs", which is a bad approach. Use the <p> tag for paragraphs.

The single <hr> tag is used to create a horizontal separator line. The appearance of this line can be set with attributes, but it is more correct to do it with CSS.

  • index.html
HTML
<!DOCTYPE html> <html> <head> <meta charset="utf-8"> <title>Line breaks and separators</title> </head> <body> <h1>Ring-verse</h1> <p> Three Rings for the Elven-kings under the sky, Seven for the Dwarf-lords in their halls of stone, Nine for Mortal Men doomed to die, One for the Dark Lord on his dark throne In the Land of Mordor where the Shadows lie. </p> <p> One Ring to rule them all, One Ring to find them, One Ring to bring them all, and in the darkness bind them In the Land of Mordor where the Shadows lie. </p> </body> </html>

The code has changed, click "Update" or enable autorun.

You have moved to another page

Click inside the mini-browser to highlight this window.

100%
GoalsCompleted
0
    1. Use the <br> tag to add four line breaks to the first paragraph,
    2. two line breaks to the second paragraph.
    3. Add separator between paragraphs using the <hr> tag.

    © 2023-2024, codehero.pro