# Here is a way to do Table of Contents (ToC)

**URL:** <https://forum.ghost.org/t/here-is-a-way-to-do-table-of-contents-toc/5419>\
**Category:** Themes\
**Created:** [February 1, 2019, 7:14pm UTC](https://forum.ghost.org/t/here-is-a-way-to-do-table-of-contents-toc/5419 "2019-02-01T19:14:54Z")\
**Posts on this page:** 1\
**Showing post:** 33

<div class="post-metadata">

**Author:** ![Stromfeldt](https://sea1.discourse-cdn.com/flex015/user_avatar/forum.ghost.org/stromfeldt/32/13572_2.png) [@Stromfeldt](https://forum.ghost.org/u/Stromfeldt)\
**Post date:** [February 28, 2020, 12:49am UTC](https://forum.ghost.org/t/here-is-a-way-to-do-table-of-contents-toc/5419/33 "2020-02-28T00:49:14Z")

</div>

If anybody else ever has this problem in the future I came up with a solution.

David suggested I add `clear: both` to my headings, although this created some spacing problems. If that happens to you then you can rectify this by adding some negative `margin-bottom` to the `<figure>`. Adding negative `margin-top` to the `h2` or `h3` did nothing for some unknown reason.

Here’s the CSS:

```auto
.post-content h2,
.post-content h3 {
    clear: both;
}
.prior-to-heading {
    margin-bottom: -50px;
}

```

For the image you’re going to have to utilize an HTML-card, which will basically look like this:

```auto
<figure class="prior-to-heading">
    <img src=" ____">
    <figcaption></figcaption>
</figure>

```

If you don’t know how to set up an image with an HTML-card I explained that [here](https://forum.ghost.org/t/whats-the-best-way-to-add-a-link-to-an-image-on-a-post/11025/2) (skip the bit about adding in the `<a>` tag).

---

_[View the full topic](https://forum.ghost.org/t/here-is-a-way-to-do-table-of-contents-toc/5419)._
