> For the complete documentation index, see [llms.txt](https://docs.realmacsoftware.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.realmacsoftware.com/elements/elements-cms/markdown/styling-lists.md).

# Styling Lists

Adding styling for lists (ul and ol) in Elements CMS

If you’re using lists in your Markdown documents, it’s worth adding some styling. You can either apply Tailwind classes directly to your Typography component, or add a small block of custom CSS to your project template.

Here are some example Tailwind classes you can drop into the Typography CSS Classes field:

```php-template
[&_ul]:list-disc
[&_ul]:pl-4
[&_ul]:mt-3
[&_ul]:mb-3
[&_ul_li]:my-1
[&_ul_li]:marker:text-gray-500
```

<figure><img src="https://3876014504-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FNy6AECEVH2p4eFDicpM1%2Fuploads%2Fgit-blob-c010b148e93aa0576fdd0653c3fd342a0273f87c%2FCleanShot%202025-11-24%20at%209%E2%80%AF.44.06%402x.png?alt=media" alt=""><figcaption></figcaption></figure>

Or:

```ruby
[&_ul]:list-disc
[&_ul]:pl-5
[&_ul]:space-y-2
[&_ul_li]:leading-relaxed
[&_ul_li]:text-gray-800
```

For ordered lists:

```markdown
[&_ol]:list-decimal
[&_ol]:pl-5
[&_ol]:space-y-2
[&_ol_li]:my-1
```

And if you want tighter spacing:

```ruby
[&_ul]:list-disc [&_ul]:pl-4 [&_ul_li]:my-0.5
```

Alternatively you can add the following vanilla CSS to your project template’s `<head>` section, but we highly recommend using Tailwind.

{% code overflow="wrap" %}

```css

<style>
ul, ol {
  padding-left: 1.25rem;
  margin: 0.75rem 0;
}
ul {
  list-style: disc;
}
ol {
  list-style: decimal;
}
ul li,
ol li {
  margin: 0.25rem 0;
  line-height: 1.5;
  color: #333;
}
</style>
```

{% endcode %}

<figure><img src="https://3876014504-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FNy6AECEVH2p4eFDicpM1%2Fuploads%2Fgit-blob-5b48c32fc35bdc5213a3225d007f428f2156030f%2FCleanShot%202025-11-24%20at%209%E2%80%AF.47.29%402x.png?alt=media" alt=""><figcaption></figcaption></figure>

### Styling links in lists

Tailwind’s arbitrary variants let you chain selectors togther, the following is an example of styling an ordered list containing links.

```css
[&_ol]:list-decimal
[&_ol]:pl-5
[&_ol]:space-y-2
[&_ol_li]:my-1
[&_ol_li_a]:text-blue-600
[&_ol_li_a]:underline
```

That \[&\_ol\_li\_a] selector is doing:

* \_ol → the ordered list
* \_li → list items inside it
* \_a → links inside the list items

If you want hover styles as well:

```css
[&_ol_li_a:hover]:text-blue-800
```

Or if you want something a bit more refined:

```css
[&_ol_li_a]:text-primary
[&_ol_li_a]:no-underline
[&_ol_li_a:hover]:underline
```


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation by asking a question.

Perform an HTTP GET request on the following URL with the `ask` and `goal` query parameters:

```
GET https://docs.realmacsoftware.com/elements/elements-cms/markdown/styling-lists.md?ask=<question>&goal=<user_goal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is what the user is ultimately trying to achieve, the reason they need the answer. Sharing it helps GitBook give you a better, more relevant answer. A goal is most helpful when it describes the outcome the user wants rather than restating the question. For example, with `ask=how do I create an API token`, a goal like `automate deployments from our CI pipeline` lets GitBook tailor the answer to that use case.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
