Search
Close this search box.

How to Set Indentation of List Element in Gutenberg

With the Gutenberg WordPress editor, you can utilize blocks to create visually appealing and captivating content. The List block, for example, is a frequently used block that enables you to add numbered (ordered) and bulleted (unordered) lists to your post or pages.

But how do you set the indentation of a list element in Gutenberg? In this article, we will show you how to do that by adding a very simple CSS snippet that allows you to change the indentation value of the list element to your desired level.

Setting List Element Indentation in Gutenberg

Alright, setting the indentation of a list element in Gutenberg is very easy. The only thing that you need to do is add the very simple CSS snippet to the Additional CSS block on Theme Customizer.

On your WordPress dashboard, go to Appearance -> Customizer -> Additional CSS. A little note. If you use a block theme, you need to enable the Theme Customizer first to easily add custom CSS.

Once you enter the Additional CSS block, please copy the simple CSS snippet below and paste it into the available field.

ul li {
  margin-left: 30px;
}

ol li {
  margin-left: 30px;
}

Once you finish adding the CSS snippet, apply it by clicking the PUBLISH button.

The Code Explanation:

The CSS rule has a selector and a declaration block. The selector is ul li, ol li, which means it matches any li element that is a descendant of either an unordered list or an ordered list element.

The declaration block is { margin-left: 30px; }, which means it sets the left margin of the matched elements to 30 pixels

The effect of this CSS rule is that it indents the list items (ordered and unordered) by 30 pixels from the left edge of their parent element. This creates some visual separation between the list and the rest of the content. You can replace ”30px“ with your desired spacing value.

That’s it. To see how the CSS snippet you’ve added works, you can create a new post type or select the existing one (page or post) with the List block (ordered and unordered).

The Bottom Line

This article explains how to set the indentation of list elements in the Gutenberg WordPress editor without relying on any plugins. It provides a simple CSS snippet that you can add to the Additional CSS block in the Theme Customizer.

The snippet sets the margin-left property of list items to 30px, which indents them from the left edge of their parent element. You can replace the “30px” value with your desired spacing.

In summary, this article shows you how to achieve a visually appealing look for your lists in Gutenberg with a quick and easy CSS modification.

This page may contain affiliate links, which help support our project. Read our affiliate disclosure.
Picture of Akbar Padma

Akbar Padma

Akbar is a WordPress expert and a writer staff at WPPagebuilders. He mainly writes about Gutenberg, Elementor, Divi, and other WordPress page builders.
Want to turn your WordPress knowledge into revenue? OF COURSE!

Leave a Comment

Share This
Hey 👋🏻
Do you have a WP blog?
If so, you may need these. All the resources you need to grow your blog.

Your popup content goes here

50%

Where should we send the template?

After entering your email address, you will be added to our newsletter subscribers. You can unsubscribe anytime.

Want to Build Passive Income Like the One on the Screenshot Below?

Click the button on the right side to learn how 👉🏻
5 easy steps to turn your WordPress knowledge into monthly recurring revenue.

Click the above button to close the popup.