By Stephen Walker

Share

I have seen some tables of contents around the web that use what appears as a left border, and the border color changes when highlighted. This feature is missing from the current version of Avada, so I created CSS styling to do this. It works best with a single-level list. Your color value will vary, and possibly the spacing values. This does require the highlight feature to be enabled. Item padding can be adjusted in the settings (I chose 12px on all sides), and margins are set to 0 to give the appearance of a continuous border. I have created a class (.toc- -border-left ) in case I want to use another style elsewhere.

UPDATE: My original version was more complicated, requiring pseudo-elements, and I am not sure why I didn’t try the simple approach first. This shows how simple it would be to implement, and I am surprised it was not a feature in the original version.

.toc--border-left .awb-toc-el__item-anchor{
  border-left:3px var(--awb-color3) solid;
}
.toc--border-left .awb-toc-el__list-item.awb-toc-el__list-item--highlighted > .awb-toc-el__item-anchor{
  border-left:3px var(--awb-color6) solid;
}

Originally published on March 31, 2023

Outdated Content Shortcode
Get the First Letter of the Post Title

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.

RELATED Snippets

  • Avada, CSS, JavaScript

    This creates a floating container. More to come.

  • Avada, CSS

    This is a style I recently used on my blog post title bar to have the feature image fill the column without having to use a background image.

  • Avada

    The social sharing element has some styles that prevent stacking them in a column. This CSS will resolve this. Just assign the class to each instance.

  • Avada, CSS

    This gives the default RSS feed widget a more polished appearance.

  • Avada

    The Toggle Element styling leaves a bit to be desired as it applies hover effects to the entire block and not just the header and the panel. This should override that behavior but still takes advantage of the settings, thanks to the use of CSS variables. Example

  • Avada, CSS

    Another example of using a skewed background, this time targeting the pagination preview. Additionally, this limits the width of the preview and allows the text to wrap. Lastly, a clip-path is used to give the featured image a skewed appearance.