How to link to a section of another page.. help

There are 3 pages in my website. Home , about, article… about page has 5 sections… I want to link somehow to section 4 and 5 from articles page… how to do that??

On the page you will need to give IDs to each section, and then on the articles page you will link to newpage.html#section1 etc.

4 Likes
<h1>Articles</h1>
<p>Link to About page <a href="about.html#section4">Section 4</a></p>
<p>Link to About page <a href="about.html#section5">Section 5</a></p>

<p>Link to Articles <a href="#section4">Section 4</a></p>
<p>Link to Articles <a href="#section5">Section 5</a></p>

<section>
    <h1 id="section4">This is section 4</h1>
    <p>Lorem ipsum dolor sit amet, consetetur sadipscing elitr, 
sed diam nonumy eirmod tempor invidunt ut labore et dolore magna 
aliquyam erat, sed diam voluptua. At vero eos et accusam et justo 
duo dolores et ea rebum. Stet clita kasd gubergren, no sea takimata 
sanctus est Lorem ipsum dolor sit amet. Lorem ipsum dolor sit amet, 
consetetur sadipscing elitr,  sed diam nonumy eirmod tempor 
invidunt ut labore et dolore magna aliquyam erat, sed diam voluptua.</p>
</section>

<section>
    <h1 id="section5">This is section 5</h1>
    <p>Duis autem vel eum iriure dolor in hendrerit in vulputate 
velit esse molestie consequat, vel illum dolore eu feugiat nulla 
facilisis at vero eros et accumsan et iusto odio dignissim qui blandit 
praesent luptatum zzril delenit augue duis dolore te feugait nulla facilisi.</p>
</section>
1 Like

This will work from within the same page. But as the OP requires a link from a different page, the href will need the the specific page URL to precede the ID, as @Gandalf did.

2 Likes

OK, corrected.

This topic was automatically closed 91 days after the last reply. New replies are no longer allowed.