Basics of web development

HTML Links

Easy
15 min

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:

<a href="https://google.com/">Go to google.com</a>
<a href="/toinen-sivu.html">Go to another page</a>
<a href="#osa-sivusta">Go to part of the page</a> ...<h2 id="osa-sivusta"> This is part of the page</h2>
<a href="mailto:esimerkki@example.com">send email</a>
<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>

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

Kokeile itse!

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.

hakatemia pro

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.