# CSS for Markdown, numbered headings

**URL:** <https://discourse.devontechnologies.com/t/css-for-markdown-numbered-headings/71404>\
**Category:** Tips\
**Created:** [June 11, 2022, 12:24pm UTC](https://discourse.devontechnologies.com/t/css-for-markdown-numbered-headings/71404 "2022-06-11T12:24:09Z")\
**Posts on this page:** 20\
**Page:** 1

<div class="post-metadata">

**Author:** ![chrillek](https://discourse.devontechnologies.com/user_avatar/discourse.devontechnologies.com/chrillek/32/29340_2.png) [@chrillek](https://discourse.devontechnologies.com/u/chrillek)\
**Post date:** [June 11, 2022, 12:24pm UTC](https://discourse.devontechnologies.com/t/css-for-markdown-numbered-headings/71404/1 "2022-06-11T12:24:09Z")

</div>

This is the eigth part of some posts on using CSS in and with DT/DTTG. Though I wrote it as a single piece, I broke it up in smaller installments to keep the posts (barely) managable. Please let me know (preferably by a PM) if you find errors of any kind or are missing details. I’ll correct the first ones and try to help with the second ones.

[Previous post](https://discourse.devontechnologies.com/t/css-for-markdown-styling-tables/71369) | [Next post](https://discourse.devontechnologies.com/t/css-for-markdown-dark-mode/71422)

## Numbered headings

By default, headings appear in HTML just as you typed them in your Markdown  
document. Especially in scientific publications, some kind of systematic numbering is often required. You can of course provide that by simply adding the number to your heading. However, that requires a lot of manual work and more so whenever you add, move or delete parts of the document.

CSS offers a much simpler way to render systematically numbered headlines with its concept of “counters”. You can read [all about counters at MDN](https://developer.mozilla.org/en-US/docs/Web/CSS/CSS_Counter_Styles/Using_CSS_counters#using_counters). The following examples are just a very limited demonstration of their abilities.

Let’s assume a Markdown document like this

```markdown
# First heading
# Second heading
## First sub-heading of second heading
# Third heading
## First sub-heading of third heading
### Third heading's first sub-heading's first subheading
## Second sub-heading of third heading
# Fourth heading

```

Rendering that as HTML results in something like this

 ![Headings no style](https://devontech-discourse.s3.dualstack.us-east-1.amazonaws.com/uploads/original/3X/6/f/6f4c30b43e98e6521806f558453ab7a6842ba689.png)  
Adding a counter to the headings requires three steps:

- creating and initializing the counter with `counter-reset`,
- incrementing it with `counter-increment`, and
- displaying it with `content` and `counter()`.

For the first level headings, you’d do it like this:

```css
body {
  counter-reset: h1;
}
h1::before {
  counter-increment: h1;
  content: counter(h1) ". ";
}

```

First, you create a counter named `h1` in the CSS rule for the `body` element. Its value is set to `0` by default. Then comes the `::before` pseudo-element for the `h1` element. It’s different from other CSS selectors in that it _creates_ an element (a pseudo one, though) in the `h1` element just before anything that is already part of this element. So the (pseudo-HTML) for the first heading would look like  
`<h1><before>…</before>First heading</h1>`

Note that this `before` element does not exist! However, you can create and style it in a stylesheet like here. The rule for `h1::before` first increments the counter `h1` with `counter-increment`. Since it started out with `0` because of the `body` rule, it will now be `1`. Then this value is prepended to the content of `h1` with the `content:` directive: `counter(h1)`  
gets the value of the counter, and `". "` appends a dot and a space. After all that, the headlines look like this:

 ![Headings 1st level numbering](https://devontech-discourse.s3.dualstack.us-east-1.amazonaws.com/uploads/original/3X/0/6/0629f2714fb4789a7bddc6f6e8de0a0a0019526c.png)  
Now adding the corresponding rules for 2nd and 3rd level headings is a lot easier:

```css
h1 {
  counter-reset: h2;
}
h2 {
  counter-reset: h3;
}
h2::before {
  counter-increment: h2;
  content: counter(h1) "." counter(h2) ". ";
}
h3::before {
  counter-increment: h3;
  content: counter(h1) "." counter(h2) "." counter(h3) ". ";
}

```

The only new things here are the `content:` definitions for the level 2 and 3 headings and the `counter-reset`s: Whenever a new level 1 heading appears, the `h2` counter must be reset so that the next level 2 heading is numbered with 1 again. The same holds for a new level 2 heading that must reset the `h3` counter.

 ![Headings all levels numbering](https://devontech-discourse.s3.dualstack.us-east-1.amazonaws.com/uploads/original/3X/3/4/340a1d664ff3a80aa54d483f5ae5709fce30184d.png)

If you now move the line “# Second Heading” down to just before “# Third heading”, you’ll get this HTML:

 ![Headings 2nd moved](https://devontech-discourse.s3.dualstack.us-east-1.amazonaws.com/uploads/original/3X/6/3/6371960e0896fcc77cb0a21bf69e404f9e904001.png)

As you can see, the former “2.1 First sub-heading of second heading” has now become “1.1 First sub-heading of second heading”, since it’s now following the first `h1` element, no longer the second one.

If you delete the line “# Second Heading” completely, the numbering for all subsequent headings will be adjusted:

 ![Heading 2nd removed](https://devontech-discourse.s3.dualstack.us-east-1.amazonaws.com/uploads/original/3X/1/7/17107168ef24028f6abee82c319a6f67fbe7d8c9.png)  
CSS counters can not only be used for headings but also for lists, footnotes and  
links. You’re not limited to arabic numerals but can[define your own `counter-style`](https://developer.mozilla.org/en-US/docs/Web/CSS/CSS_Counter_Styles).

---

<div class="post-metadata">

**Author:** ![kerryjcox](https://discourse.devontechnologies.com/letter_avatar_proxy/v4/letter/k/57b2e6/32.png) [@kerryjcox](https://discourse.devontechnologies.com/u/kerryjcox)\
**Post date:** [September 2, 2022, 11:11pm UTC](https://discourse.devontechnologies.com/t/css-for-markdown-numbered-headings/71404/2 "2022-09-02T23:11:57Z")

</div>

Quick question. How would you go about disabling the numbering of certain headings? Say, you wanted to have a title using h1, but did not want there to be a number attached? Or if you wanted to start on the third h2 heading and not on the first?

I have seen a couple mentions of a .nocount:after and content: none in the CSS code, but have been unsuccessful in implementing this.

Thanks.

---

<div class="post-metadata">

**Author:** ![chrillek](https://discourse.devontechnologies.com/user_avatar/discourse.devontechnologies.com/chrillek/32/29340_2.png) [@chrillek](https://discourse.devontechnologies.com/u/chrillek)\
**Post date:** [September 3, 2022, 9:03am UTC](https://discourse.devontechnologies.com/t/css-for-markdown-numbered-headings/71404/3 "2022-09-03T09:03:16Z")

</div>

First off: I think that is a bad idea, and will explain why at the end of this post.

Let’s start with a default styling like so

```css
body {
  counter-reset: h1;
}
h1::before {
  counter-increment: h1;
  content: counter(h1) ". ";
}
h1 {
  counter-reset: h2;
}
h2::before {
  counter-increment: h2;
  content: counter(h1) "." counter(h2) ". ";
}

```

and a Markdown document

```markdown
# 1st level heading no1

## 2nd level heading no 1

## 2nd level heading no 2

## 2nd level heading no 3

# 1st level heading no 2

```

With this example, you’ll get

```auto
1. 1st level heading no 1
1.1 2nd level heading no 1
1.2 2nd level heading no 2
1.3 2nd level heading no 3
2. 1st level heading no 2

```

As to your questions:

- If you do not want a number attached to `h1`, simply do not define a rule for `h1::before`.
- If you do want `h2` with numbers only starting with the third such element, use something like this

```auto
h2:nth-of-type(n+3):before {
  counter-increment: h2;
  content: counter(h1) "." counter(h2) ". ";
}

```

That’ll give you

```auto
1. 1st level heading no 1
2nd level heading no 1
2nd level heading no 2
1.1 2nd level heading no 3
2. 1st level heading no 2

```

But you may still need to define a `counter-increment` on `h1::before` to prevent weird numbers appearing for `h2`. See the (always very helpful) explanation on MDN:

> **[:nth-of-type() - CSS: Cascading Style Sheets | MDN](https://developer.mozilla.org/en-US/docs/Web/CSS/:nth-of-type)**
>
> The :nth-of-type() CSS pseudo-class matches elements based on their position among siblings of the same type (tag name).

Now that that’s out of the way: **Why** do you want to do that? Having numbered headings helps to structure the content. Having some of the headings numbered and others not, defies that concept.

If you want to have something that _looks_ like a `h2` but isn’t one, you should rethink. All the `hx` elements have semantics. If you have them in your text, they should have similar semantics. Having a `h2` element that is not _meant_ to be one, goes against the ideas of structured make up. You’d be closer to good practices if you’d use for example a `div` element and style that appropriately, since a `div` has no semantics.

> [@kerryjcox](#):
>
> I have seen a couple mentions of a .nocount:after and content: none in the CSS code, but have been unsuccessful in implementing this.

What exactly is “the CSS code” here? And it may be that defining a class “nocount” helps somehow, but without _seeing_ “the CSS code” and the corresponding Markdown, who knows? Also, setting attributes like class names in Markdown is not widely supported. For example, MultiMarkdown (the dialect used in DT), does allow HTML attributes only for links and images.

---

<div class="post-metadata">

**Author:** ![kerryjcox](https://discourse.devontechnologies.com/letter_avatar_proxy/v4/letter/k/57b2e6/32.png) [@kerryjcox](https://discourse.devontechnologies.com/u/kerryjcox)\
**Post date:** [September 3, 2022, 4:44pm UTC](https://discourse.devontechnologies.com/t/css-for-markdown-numbered-headings/71404/4 "2022-09-03T16:44:48Z")

</div>

Thanks much for taking the time to reply. I realize I am attempting to manipulate Markdown in ways it was not architected to do so. That said, I would much rather be using LaTeX and Pandoc for generating the student and lab guides we currently make.

To give you some background, We use Typora as the authoring tool along with some custom .css themes for customizing the look and feel. Typora creates the PDF, as needed, for both student and lab guides.  
The guides themselves require a title (h1), and overview and lab diagrams section (h2), and the remaining sections and sub-sections are Parts and Steps and require being ordered and numbered (h2 and h3). All Parts and Steps are currently manually numbered, and when the guides get long, when someone wants to add a step or Part in, there is a lot of legwork involved to get everything correct and invariably someone makes a mistake. Hence, my request for some auto-numbering.

I suspect Markdown will not be able to accomplish what I would like to do, and so I may attempt to migrate the custom .css themes from Typora into something like eisvogel or TeX and see if that might work better.

Thanks again for the reply and explanation.

---

<div class="post-metadata">

**Author:** ![BLUEFROG](https://discourse.devontechnologies.com/user_avatar/discourse.devontechnologies.com/bluefrog/32/135_2.png) [@BLUEFROG](https://discourse.devontechnologies.com/u/BLUEFROG)\
**Post date:** [September 3, 2022, 4:49pm UTC](https://discourse.devontechnologies.com/t/css-for-markdown-numbered-headings/71404/5 "2022-09-03T16:49:34Z")

</div>

Can you post an example document showing the finished product?

---

<div class="post-metadata">

**Author:** ![chrillek](https://discourse.devontechnologies.com/user_avatar/discourse.devontechnologies.com/chrillek/32/29340_2.png) [@chrillek](https://discourse.devontechnologies.com/u/chrillek)\
**Post date:** [September 3, 2022, 4:50pm UTC](https://discourse.devontechnologies.com/t/css-for-markdown-numbered-headings/71404/6 "2022-09-03T16:50:32Z")

</div>

> [@kerryjcox](#):
>
> I suspect Markdown will not be able to accomplish what I would like to do,

Which is what exactly? Not to discourage you from using TeX, but that’s even more demanding then Markdown. CSS is quite powerful today. Since that’s not really on-topic here, we can take that to PM.

---

<div class="post-metadata">

**Author:** ![signsinthedust](https://discourse.devontechnologies.com/letter_avatar_proxy/v4/letter/s/e99b99/32.png) [@signsinthedust](https://discourse.devontechnologies.com/u/signsinthedust)\
**Post date:** [March 19, 2024, 1:28am UTC](https://discourse.devontechnologies.com/t/css-for-markdown-numbered-headings/71404/7 "2024-03-19T01:28:18Z")

</div>

Excellent guide. I am learning about CSS, using Brett Terpstra’s style sheet to experiment. It has a styling for poetry, but I have been unable to invoke it in a markdown note. Here is the styling in the CSS file:

```auto
pre {
	background-color:	#f8f8f8;
	border: 1px solid #ccc;
	font-size: 14px;
	line-height: 19px;
	overflow: auto;
	padding: 6px 10px;
	border-radius: 3px;
	margin: 26px 0;
}

.poetry pre {
	font-family:	Georgia, Garamond, serif !important;
	font-style: italic;
	font-size: 110% !important;
	line-height:	1.6em;
	display: block;
	margin-left:	1em;
}

```

And here is how I attempt to invoke it in my note:

```auto
<pre type="poetry">Roses are red,
Violets are blue.
This is CSS poetry,
Nicely rendered for you!</pre>

```

And here is the result

 ![Screenshot-The Human Person A Beginner's Thomistic Psychology-2024-03-18 at 18.27.40 PM](https://devontech-discourse.s3.dualstack.us-east-1.amazonaws.com/uploads/original/3X/e/e/eefddea5bf6c963b841f5735385f470ba5306617.jpeg)

None of the attributes from the style sheet are applied, I think. What am I doing wrong?

[OpSpl style sheet.zip](https://discourse.devontechnologies.com/uploads/short-url/9nFZQHqKnD4OXyXmWT2zQb5PUeb.zip) (19.2 KB)

---

<div class="post-metadata">

**Author:** ![BLUEFROG](https://discourse.devontechnologies.com/user_avatar/discourse.devontechnologies.com/bluefrog/32/135_2.png) [@BLUEFROG](https://discourse.devontechnologies.com/u/BLUEFROG)\
**Post date:** [March 19, 2024, 3:05am UTC](https://discourse.devontechnologies.com/t/css-for-markdown-numbered-headings/71404/8 "2024-03-19T03:05:52Z")

</div>

Note, i am not a Markdown purist but the insertion of HTML in Markdown is often considered to be bad form.

- You aren’t using a `type`. It’s a `class`.
- Where are you linking the stylesheet in the Markdown document?

I also strongly suggest you do not mess with stylesheets during the learning and development of CSS styling on a document. Just put the styling in the document as shown here so you can edit, save, and immediately see the changes.

 ![image](https://devontech-discourse.s3.dualstack.us-east-1.amazonaws.com/uploads/original/3X/7/3/73c8c8aa1b8ad9605bb19b23033e613b9808d32f.jpeg)

```auto
<style type="text/css">
.poetry {
 padding: 1em;
 font-family: Georgia, Garamond, serif;
 font-style:italic;
 font-size:110%;
 line-height: 1.6em;
 background-color: rgba(230,210,0,.3);
 color: rgba(100, 80,0,1);
}
</style>

```

When you’re satisfied, copy and paste it into an external stylesheet, if you so desire. But bear in mind, there is no requirement to use an external stylesheet.

---

<div class="post-metadata">

**Author:** ![signsinthedust](https://discourse.devontechnologies.com/letter_avatar_proxy/v4/letter/s/e99b99/32.png) [@signsinthedust](https://discourse.devontechnologies.com/u/signsinthedust)\
**Post date:** [March 19, 2024, 3:11am UTC](https://discourse.devontechnologies.com/t/css-for-markdown-numbered-headings/71404/9 "2024-03-19T03:11:27Z")

</div>

It’s in the zip that I attached above. I took it from the following thread:

> [@A CSS to embellish \*MultiMarkdown\* rendering](https://discourse.devontechnologies.com/t/a-css-to-embellish-multimarkdown-rendering/58828):
>
> Hi all ! Many people have read, studied and enjoyed Kourosh Dini’s Taking Smart Notes with DEVONthink. He mentioned and distributed a “pre-release” CSS (Cascading Style Sheet) that I was refining for my personal use. With Kourosh’s stimulation and the knowledge that it might be appreciated by some people, I went on with the development of this style sheet. Please, do take into account that I’m not a graphic designer nor a programmer. I copied a [Brett Terpstra](https://brettterpstra.com/) stylesheet that he designed for hi…

---

<div class="post-metadata">

**Author:** ![meowky](https://discourse.devontechnologies.com/letter_avatar_proxy/v4/letter/m/85e7bf/32.png) [@meowky](https://discourse.devontechnologies.com/u/meowky)\
**Post date:** [March 19, 2024, 3:11am UTC](https://discourse.devontechnologies.com/t/css-for-markdown-numbered-headings/71404/10 "2024-03-19T03:11:59Z")

</div>

> [@signsinthedust](#):
>
> `<pre type="poetry">...</pre>`

~~According to the provided CSS, the correct syntax should be `<div class="poetry"><pre>...</pre></div>`.~~

EDIT: This is not the only way to get it done. Thanks to commenters below for correcting me!

---

<div class="post-metadata">

**Author:** ![BLUEFROG](https://discourse.devontechnologies.com/user_avatar/discourse.devontechnologies.com/bluefrog/32/135_2.png) [@BLUEFROG](https://discourse.devontechnologies.com/u/BLUEFROG)\
**Post date:** [March 19, 2024, 3:30am UTC](https://discourse.devontechnologies.com/t/css-for-markdown-numbered-headings/71404/11 "2024-03-19T03:30:47Z")

</div>

Actually, the styling applies to the class regardless of the HTML element. And the chosen element may have some default styling already applied, e.g.,…

 ![image](https://devontech-discourse.s3.dualstack.us-east-1.amazonaws.com/uploads/original/3X/5/7/57d7532c48f4a4e588882e184d84b86d8cb26076.jpeg)

And again, this is considered bad form, and though I’m not a purist about it, I’d agree this is not a good direction to go in. In this case, I’d suggest just making an HTML document – which you can natively create and edit in DEVONthink – and writing raw HTML markup as that’s what’s already going on here. @signsinthedust is saving nothing by putting it in a Markdown document.

@signsinthedust: You should really define your purpose for the document. If you’re just creating a document with a poem, nicely formatted, there is no need for such contrivances as putting in classes and raw HTML. You could very simply use and style, e.g., headers and paragraph elements, like so…

 ![image](https://devontech-discourse.s3.dualstack.us-east-1.amazonaws.com/uploads/original/3X/b/f/bfb228608827b3a5dd9cf69c0f0662f5a541eb52.jpeg)

---

<div class="post-metadata">

**Author:** ![signsinthedust](https://discourse.devontechnologies.com/letter_avatar_proxy/v4/letter/s/e99b99/32.png) [@signsinthedust](https://discourse.devontechnologies.com/u/signsinthedust)\
**Post date:** [March 19, 2024, 4:09am UTC](https://discourse.devontechnologies.com/t/css-for-markdown-numbered-headings/71404/12 "2024-03-19T04:09:45Z")

</div>

This is where the stylesheet is:

 ![Screenshot-Files-2024-03-18 at 21.09.06 PM](https://devontech-discourse.s3.dualstack.us-east-1.amazonaws.com/uploads/original/3X/b/d/bd624c40ed8883afe84e3d78b3da00a6924373b9.jpeg)

---

<div class="post-metadata">

**Author:** ![signsinthedust](https://discourse.devontechnologies.com/letter_avatar_proxy/v4/letter/s/e99b99/32.png) [@signsinthedust](https://discourse.devontechnologies.com/u/signsinthedust)\
**Post date:** [March 19, 2024, 4:15am UTC](https://discourse.devontechnologies.com/t/css-for-markdown-numbered-headings/71404/13 "2024-03-19T04:15:03Z")

</div>

This worked, thanks!

---

<div class="post-metadata">

**Author:** ![chrillek](https://discourse.devontechnologies.com/user_avatar/discourse.devontechnologies.com/chrillek/32/29340_2.png) [@chrillek](https://discourse.devontechnologies.com/u/chrillek)\
**Post date:** [March 19, 2024, 6:56am UTC](https://discourse.devontechnologies.com/t/css-for-markdown-numbered-headings/71404/14 "2024-03-19T06:56:16Z")

</div>

> [@BLUEFROG](#):
>
> But bear in mind, there is no requirement to use an external stylesheet

Right. But if you want to have consistent styling, that’s by far the best approach. Imagine having literal style in a bunch of MD documents.– you’d have to modify each document just to modify the font or the margins consistently.

---

<div class="post-metadata">

**Author:** ![chrillek](https://discourse.devontechnologies.com/user_avatar/discourse.devontechnologies.com/chrillek/32/29340_2.png) [@chrillek](https://discourse.devontechnologies.com/u/chrillek)\
**Post date:** [March 19, 2024, 9:25am UTC](https://discourse.devontechnologies.com/t/css-for-markdown-numbered-headings/71404/15 "2024-03-19T09:25:07Z")

</div>

Well, the CSS should adjust to the HTML, not the other way round. There’s nothing that says a `pre` must be wrapped in a `div` (though that’ll perhaps _happen_ in the context of rendered MD).

---

<div class="post-metadata">

**Author:** ![arasmus](https://discourse.devontechnologies.com/user_avatar/discourse.devontechnologies.com/arasmus/32/34167_2.png) [@arasmus](https://discourse.devontechnologies.com/u/arasmus)\
**Post date:** [March 19, 2024, 5:41pm UTC](https://discourse.devontechnologies.com/t/css-for-markdown-numbered-headings/71404/16 "2024-03-19T17:41:38Z")

</div>

(Replying to 'frog’s earlier post)

Guilty as charged! Proudly so. But your advice is good for most. (Still, I’ve got a _sweet_ setup going on here.)

---

<div class="post-metadata">

**Author:** ![mlebo10](https://discourse.devontechnologies.com/letter_avatar_proxy/v4/letter/m/4bbf92/32.png) [@mlebo10](https://discourse.devontechnologies.com/u/mlebo10)\
**Post date:** [August 21, 2024, 1:11pm UTC](https://discourse.devontechnologies.com/t/css-for-markdown-numbered-headings/71404/17 "2024-08-21T13:11:07Z")

</div>

Was there a recent update to Chrome and Edge that would break this? Our headings aren’t incrementing properly in Chrome and Edge. Firefox still renders correctly, ironically. Appreciate any insights anyone might have to help us solve this.

Here is our CSS:

```auto
body.api {
	.Page {
		counter-reset: h1 h2 h3;
		h1,
		h2,
		h3 {
			&:before {
				opacity: 0.5;
			}
		}
		h1 {
			counter-reset: h2;
			&:before {
				counter-increment: h1;
				content: counter(h1) " ";
			}
		}
		h2 {
			counter-reset: h3;
			&:before {
				counter-increment: h2;
				content: counter(h1) "." counter(h2) " ";
			}
		}
		h3:before {
			counter-increment: h3;
			content: counter(h1) "." counter(h2) "." counter(h3) " ";
		}
	}

	.tocify {
		counter-reset: h1;
	}
	.tocify-item {
		a {
			&:before {
				counter-increment: h1;
				content: counter(h1) " ";
				font-weight: bold;
				opacity: 0.5;
			}
		}
	}
	.tocify-subheader {
		counter-reset: h2;
		.tocify-item {
			a {
				&:before {
					counter-increment: h2;
					content: counter(h1) "." counter(h2) " ";
				}
			}
		}
	}
}

```

---

<div class="post-metadata">

**Author:** ![chrillek](https://discourse.devontechnologies.com/user_avatar/discourse.devontechnologies.com/chrillek/32/29340_2.png) [@chrillek](https://discourse.devontechnologies.com/u/chrillek)\
**Post date:** [August 21, 2024, 1:22pm UTC](https://discourse.devontechnologies.com/t/css-for-markdown-numbered-headings/71404/18 "2024-08-21T13:22:03Z")

</div>

Without the HTML, the CSS does not tell much. Except that it does not really look as if it were written for MD rendering. And CSS in general is not on-topic here – there are better places to discuss these questions.

In any case, there _is_ no pseudo-selector `:before`, not since ages. It may well be that Chrome ignores an invalid selector.

---

<div class="post-metadata">

**Author:** ![mlebo10](https://discourse.devontechnologies.com/letter_avatar_proxy/v4/letter/m/4bbf92/32.png) [@mlebo10](https://discourse.devontechnologies.com/u/mlebo10)\
**Post date:** [August 21, 2024, 1:27pm UTC](https://discourse.devontechnologies.com/t/css-for-markdown-numbered-headings/71404/19 "2024-08-21T13:27:38Z")

</div>

Thanks for the reply! My apologies if this is not the right place. Here is the corresponding Markdown. The CSS is in a scss file. I inherited the site from a previous developer. I think the issue is an incompatibility with counter-reset. Our main issue is that headings are showing compounded section numbers (i.e. 12.6.65 instead of 12.1.1, 12.1.2, etc)

```auto
# heading 1

## heading 2

### heading 3

### heading 3.1

```

---

<div class="post-metadata">

**Author:** ![rkaplan](https://discourse.devontechnologies.com/letter_avatar_proxy/v4/letter/r/a3d4f5/32.png) [@rkaplan](https://discourse.devontechnologies.com/u/rkaplan)\
**Post date:** [August 21, 2024, 2:53pm UTC](https://discourse.devontechnologies.com/t/css-for-markdown-numbered-headings/71404/20 "2024-08-21T14:53:10Z")

</div>

Really helpful series

Can you clarify how the CSS for counters interacts with overall CSS styling?

Do I have to definte the font and color for h1 at the same time I define the counter properties?

[Next page](https://discourse.devontechnologies.com/t/css-for-markdown-numbered-headings/71404.md?page=2)
