1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

Need help with table of contents linking

Discussion in 'Web Design' started by DTjai, Oct 22, 2017.

  1. DTjai

    DTjai Regular Member

    Nov 24, 2013
    Likes Received:
    Outreach / SEO / SEA Marketer
    Planet Earth
    Hi there,

    Thank you for your time helping me out. At this moment I am writing a pillar article and would like to link to various subtopics through the table of contents. I use wordpress and am using this code:

    Table of contents:

    <a href="#Topic1">Topic1</a>
    <a href="#Topic2">Topic2</a>
    <a href="#Topic3">Topic3</a>

    At the topic itself I use:

    <a name="Topic1"></a><h2>Topic1</h2>

    Now when I click on the table of contents it goes to the topic but my title is not to be seen because of my header blocking it.

    Anyone know of a way to show the topic title a bit lower or set the screen a bit higher on click so that it can be seen despite my header?

    Friendly regards,

  2. demoskp

    demoskp Newbie

    Dec 14, 2012
    Likes Received:

    Hey Danny, first of all I am not sure why you have the link that way because that way you are repeating yourself so as you might know in HTML you can wrap nearly any element in an <a> tag so if I was you I would use this instead
    <a href="#link"><h2>Topic1</h2></a>
    . Now concerning your issue I am not sure why it is created but you could fix that issue using CSS in many ways for example you could add either some padding or margin to the bottom of your header or some padding or margin to the top of your h2. If you offer a link to the site I can have a look at it and tell you exactly which div you need to apply a new class and add some style with CSS or which existing CSS class you can modify to fix this issue.