HTML TUTORIAL FOR BEGINNERS PART 3

Ahmadullahnikzad
1 min readJul 23, 2021

You can use 'a’(anchor) element to link to content outside of your web page.
'a' elements need a web destination address called an href attribute. It also needs an anchor text to click on it.
For example:

<a href="https://www.unsplash.com">Unsplash</a>
The browser will display the anchor text which is 'Unsplash' when you click on it will takes you to 'https://www.unsplash.com’.
a (anchor) elements has some attributes like:
1. target
2. href
3. download

Target attribute takes some parameters like:
1. _blank
2. parent
3. itself
Examples:
<a href=’https://www.freecodecamp.org' target=’_blank’>Go to freecodecamp</a>
<a href=’https://www.freecodecamp.org' target=’parent’>Go to freecodecamp</a>

<a href=’https://www.freecodecamp.org' target=’itself’>Go to freecodecamp</a>
_blank parameter opens a new tab in web browser
parent parameter opens the link on its tab it means don’t open a new tab
itself is like parent parameter.
When you download a file via HTML it is super easy.

Look at below example:
<a href=’myfile.pdf' download>download my book</a>
download attribute takes an optional parameter, if you want to provide a new name for your after downloaded.
One important thing you can do via anchor element is that we can send email and call someone

Look at the example below:
<a href="mailto:ahmad@gmail.com">Email me</a>
<a href="tel:0090987654321">contact us</a>

--

--

Ahmadullahnikzad

I am a web developer who writes web development content for you to make web development easier