HTML links are commonly used for navigating to different sections of a website, linking to other web pages, or downloading files. The link is used with the <a> tag (anchor tag) and its href attribute (hyperlink reference). Here are examples of how to use links:
Link to another website
<a href="https://google.com/">Go to google.com</a>
Link to another page on the same website
<a href="/toinen-sivu.html">Go to another page</a>
Link to anchor on the same page
<a href="#osa-sivusta">Go to part of the page</a> ...<h2 id="osa-sivusta"> This is part of the page</h2>
Email address link
<a href="mailto:esimerkki@example.com">send email</a>
Link to download file
<a href="/tiedosto.pdf" download>Download the file</a>
Target attribute
<a href="https://www.example.com" target="_blank">Open the Example site in a new window</a>
Image links
We will examine images (img tag) more closely in the next paragraph.
<a href="/toinen-sivu.html"><img src="kuva.jpg" alt="Picture"></a>
Practice
Valitettavasti Replit-palvelu on muuttnut lennosta eikä enää anna suorittaa näitä koodeja suoraan selaimessa. Voit klikata alla olevaa "Open in Replit" linkkiä ja avata koodin Replit-palvelussa. Meillä on työn alla etsiä Replitille korvaaja.
Ready to become an ethical hacker?
Start today.
As a member of Hakatemia you get unlimited access to Hakatemia modules, exercises and tools, and you get access to the Hakatemia Discord channel where you can ask for help from both instructors and other Hakatemia members.