Sitemap
Learn Web Development | For Complete Beginners

Detailed posts on web development. Go from Level 0 to Level Hero. Follow me if you like the content. Feedback is always appreciated 😇

HTML — Adding Links

--

Press enter or click to view image in full size

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>
Press enter or click to view image in full size

Try assigning different ids to different elements and then make a link to jump there.

Get TARUN KUMAR’s stories in your inbox

Join Medium for free to get updates from this writer.

Instructor ~ TARUN KUMAR

LAZY SYNTAX

--

--

TARUN KUMAR
TARUN KUMAR

Written by TARUN KUMAR

Web/App Developer | Teaching Students all Over India

Learn Web Development | For Complete Beginners
Learn Web Development | For Complete Beginners

Published in Learn Web Development | For Complete Beginners

Detailed posts on web development. Go from Level 0 to Level Hero. Follow me if you like the content. Feedback is always appreciated 😇