Need a simple way to break up sections in your Jupyter Notebook?
Adding horizontal lines (also called dividers or rulers) is an easy way to improve structure, readability, and flow – especially in longer notebooks with lots of text.
- Use
---,***, or___on a line by itself to add a horizontal divider in Markdown. - HTML also works — try
<hr>for more control or styling. - Dividers help organize sections and improve readability in your notebook.
Step 1: Open a Markdown Cell
Start by inserting a Markdown cell in your Jupyter Notebook. You can do this by clicking the “+” button and switching the cell type to Markdown, or pressing M while in command mode.
Step 2: Use Markdown Syntax for Horizontal Lines
The simplest way to insert a horizontal line is to use three dashes on a new line by themselves:
---
Other valid Markdown options include:
***
___
All three will render the same way — a solid horizontal divider stretching across the cell width.
Step 3: (Optional) Use HTML for Custom Dividers
If you want more control over how the line looks, you can use raw HTML. This is especially useful if you want to add spacing or change the color or thickness:
<hr style="height:2px; background-color:#ccc; border:none;">
This renders a custom gray line with more visual weight — perfect for section breaks or transitions in teaching notebooks.
💡 Tips for Better Notebook Design
- Use horizontal lines to break long text into readable chunks.
- Place a divider before major headings to signal a new section.
- Don’t overuse dividers — 2–3 per notebook is usually enough.
Summary
| Syntax | Result |
|---|---|
--- (or ***, ___) | Basic horizontal line |
<hr> | HTML horizontal line (default) |
<hr style="..."> | Styled divider (custom color, height, etc.) |
Adding horizontal lines is a quick, effective way to organize your Jupyter Notebook content.
Whether you’re building a tutorial, lab report, or data story, dividers make it easier for readers to follow along and understand your structure.
Learn More
Want to make better notebooks? Read our other guides:
- Most popular: How to change text color in Jupyter Notebook – Highlight important points for clarity
- How to add checkboxes in Jupyter Notebook Markdown – Track your tasks visually inside notebooks
- How to change a cell to Markdown mode (2 Ways) – Convert a cell to Markdown mode and start styling text
- How to Use LaTeX Math in Jupyter Notebook Markdown – Go beyond words and start creating equations