HTML — Adding Links
To add a link to your webpage we use the <a> tag which is short for the Anchor tag. Then we use the “href” attribute which is short for Hyperlink Reference. Then put the text inside the<a> tags to show on the webpage
<a href="http://www.google.com">Go to Google</a>
Not just text we can also use images as a link:
<a href="http://www.google.com"><img src="abc.png"></a>
You can link not just to other websites but also to the web pages we created before in a similar way:
<a href="helloworld.html">Hello World!</a>
Adding scroll to top feature:
Add an “id” attribute to the component, we will use a lot of id in CSS and JS.
To select an id we use #
<body>
<a id=”top” href=”http://www.google.com"><img href=”abc.png”> </a>
<a href=”http://www.google.com"><img href=”abc.png”></a>
<a href=”http://www.google.com"><img href=”abc.png”></a>
<a href=”http://www.google.com"><img href=”abc.png”></a>
<a href=”http://www.google.com"><img href=”abc.png”></a>
<a href=”#top”>Back to top</a>
</body>
Try assigning different ids to different elements and then make a link to jump there.
Instructor ~ TARUN KUMAR