W3Basic Logo

Markdown Headers

Markdown supports two styles of headers.

  • Setext Style
  • ATX Style

The most widely used style is atx style as it's very simple and concise.

Setext Style Heading Example

This is Setext Style H1
=============

ATX Style Heading Example

# This is atx style H1

Markdown Headings

Headings are commonly known as Titles and Subtitles that you want to display in the documents.

There is a total of six different types of headings available in markdown. These are similar to HTML headings <h1> to <h6> tags where <h1> signifies most important heading and <h6> signifies least important heading.

In Markdown, we define headings using the Hash/Number Sign (#). To create a heading in markdown, add the Number Sign (#) in front of the word or sentence. The number of # infornt of a word or phrase will determine the size of the heading.

Let us look at different types of markdown headings.

MarkdownHTML Equivalent
# Heading 1<h1> Heading 1 </h1>
## Heading 2<h2> Heading 2 </h2>
### Heading 3<h3> Heading 3 </h3>
#### Heading 4<h4> Heading 4 </h4>
##### Heading 5<h5> Heading 5 </h5>
###### Heading 6<h6> Heading 6 </h6>

Rendered Output

Heading 1

Heading 2

Heading 3

Heading 4

Heading 5
Heading 6

Alternatively, we can use Setext style syntax for Heading l and Heading 2. The Setext style headers are "underlined" using the equals sign(=) for Heading 1 and "dashes" (-) for Heading 2.

Heading 1
=========

Heading 2
---------

✅ Best Practices

  • Ensure to add a space after the number signs (#) else, the markdown editors/application won't parse into a markdown heading.
  • Add a new line before and after the headings for compatibility.
  • Use ATX-style headings as it is easier to write and keeps the markdown syntax clean and concise.

© 2023 W3Basic. All rights reserved.

Follow Us: