Bootstrap Divider

Published: 23.10.2019 | Last update: 10.6.2022

Having well-structured content on your website helps visitors to find specific information that they need. In today's snippet tutorial, we'll explore the ways how to divide text sections with <hr> dividers. 

Bootstrap Dividers are horizontal lines to create sections on various parts of your website. I have created multiple variants - solid lines, dashed lines, dotted lines, and even a text in the divider.

The Bootstrap Divider is created based on the <hr> element. Each divider is created using HTML and CSS3. You can also add custom text between the divider to create a header for each of your content sections.

I have originally created the tutorial in Bootstrap 4, but it should be fully compatible with Bootstrap 5. 

Alright, let's do it.

FAQs

What is the <hr>?

The <hr> element is a horizontal rule, which can be used to separate content.

The <hr> element is always displayed as a single line.

The width of the <hr> element is determined automatically by the browser; based on the width of its contents.

When to Use Horizontal Dividers

The <hr> element should be styled consistently with other horizontal rules in the same document when used as a separator. The hr element can also be used to mark up a thematically distinct sub-section of the document, such as a chapter title or other top-level heading in printed works.

The <hr> element should not be used for visual styling. In particular, do not insert an <hr> element between paragraphs in an attempt to force line breaks; use CSS instead if you want to control paragraph spacing and margin size.

Is the <hr> tag still used in HTML?

Yes. The <hr> tag was created in HTML 3.2 and has been supported by all browsers since then.

If you liked this snippet, you might also enjoy exploring Bootstrap Chat or Bootstrap DataTables .

Please note that the interactive editor on this page should be viewed on your laptop or desktop for the best results.

See my free Bootstrap themes Edit this snippet

How to use the snippet

There are two ways to use the snippet:

  • a] Copy it into your project. This means:
    1. Copy content of the HTML, CSS, JavaScript tabs into your project
    2. Make sure that you have jQuery 3 and Bootstrap 4's CSS and JS included in your project too.
    3. That should be it, and you should be good to go.
  • b] Use the "Edit in JSFiddle" link in the top right and play with it in the JSFiddle. After adjusting what you need, you can use the same steps as in a] to develop it locally.
Share on Facebook Share on Twitter Share on LinkedIn