# Table of contents: style current page entry

**URL:** <https://discourse.gohugo.io/t/table-of-contents-style-current-page-entry/21995>\
**Category:** support\
**Created:** [November 26, 2019, 8:23pm UTC](https://discourse.gohugo.io/t/table-of-contents-style-current-page-entry/21995 "2019-11-26T20:23:10Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![cdupont](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.gohugo.io/cdupont/32/10037_2.png) [@cdupont](https://discourse.gohugo.io/u/cdupont)\
**Post date:** [November 26, 2019, 8:23pm UTC](https://discourse.gohugo.io/t/table-of-contents-style-current-page-entry/21995/1 "2019-11-26T20:23:10Z")

</div>

Hi,  
I’m using `{{TableOfContent}}` to create a table of contents.  
I can style the elements this way:

```auto
#TableOfContents > ul > li > a {
   display: flex; 
   cursor: pointer;
   padding: 10px 0; 
   align-items: center;
   text-decoration: none;
   width: 200px;
   color: black;
}

```

However, how to highlight the current menu entry selected?  
Thanks

---

<div class="post-metadata">

**Author:** ![davidsneighbour](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.gohugo.io/davidsneighbour/32/24507_2.png) [@davidsneighbour](https://discourse.gohugo.io/u/davidsneighbour)\
**Post date:** [November 27, 2019, 2:56pm UTC](https://discourse.gohugo.io/t/table-of-contents-style-current-page-entry/21995/2 "2019-11-27T14:56:00Z")

</div>

> [@cdupont](#):
>
> `{{TableOfContent}}`

Do you have a quick sample available? I am not using this, nobody else answered 😉 I would look at your example and check the resulting markup and tell you if there is any indicator for the currently active item.

But I am afraid there won’t be any, because it’s AFTER the page loaded that you click the TOC item and end up on the corresponding item on the page.

I would expect something like `#TableOfContents > ul > li > a:active` to work, but no guarantee.

---

<div class="post-metadata">

**Author:** ![cdupont](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.gohugo.io/cdupont/32/10037_2.png) [@cdupont](https://discourse.gohugo.io/u/cdupont)\
**Post date:** [November 27, 2019, 4:30pm UTC](https://discourse.gohugo.io/t/table-of-contents-style-current-page-entry/21995/3 "2019-11-27T16:30:30Z")

</div>

@davidsneighbour Just put `{{TableOfContent}}` in a partial file (e.g. “side.html”).  
This will generate something like:

```auto
 <nav id="TableOfContents">
   <ul>
     <li>
       <a href="#overview">Overview</a>
    </li>
  </ul>
</nav>

```

Which is difficult to style, because there is not classes or ids.

---

<div class="post-metadata">

**Author:** ![davidsneighbour](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.gohugo.io/davidsneighbour/32/24507_2.png) [@davidsneighbour](https://discourse.gohugo.io/u/davidsneighbour)\
**Post date:** [November 28, 2019, 1:30pm UTC](https://discourse.gohugo.io/t/table-of-contents-style-current-page-entry/21995/4 "2019-11-28T13:30:25Z")

</div>

Did you try `#TableOfContents > ul > li > a:active`? The link should be active if it’s clicked. This might not work with directly loading the page though…
