HTML Academy
Previous task
Links and images1/17
Back to the list of tasks
  • 1. What is a link? The a tag
  • 2. Relative addresses
  • 3. Absolute addresses
  • 4. Link to the file
  • 5. An in-page link
  • 6. The img tag for images
  • 7. Image formats, SVG format
  • 8. JPEG format
  • 9. PNG format
  • 10. GIF format
  • 11. Image dimensions
  • 12. alt attribute
  • 13. Image link
  • 14. The figure and figcaption tags, demonstrative material
  • 15. Links with a blank href, title attribute
  • 16. Summary of “Links and Images”
  • 17. Test: Cat tours travel agency gallery
Relative addresses
  • Sign up
  • Log in

Loading…
Everything will be ready in few seconds

  • Theory
  • Theory
  • Comments

What is a link? The a tag

In between business meetings, Muffin decided to look at the “Blog of a Beginning Coder”. He opened the main page, and he was unable to go from it to the other blog pages. He was so confused!

And it’s all because there are absolutely no links on the site! And until we fix this, the boss will not read the blog: he is too busy to open each page separately.

What is a link?

Usually a link looks like an underlined fragment of text. When you click on it, you go to another page, open an image, start downloading a file, or move to some place on the current page. If we imagine that the Internet is a huge network with many nodes, then the links are the threads connecting all of the nodes in this network together.

Links are created using a very short <a> tag (which is short for “anchor”). For example, it looks like this:

<a href="https://htmlacademy.org">HTML Academy</a>

The link address is specified in the URL format using the href attribute (which is short for “hyper reference”).

Let’s try to create a link in our blog and to click on it!

Comments

  • index.html
  • style.css
HTML
<!DOCTYPE html> <html lang="en"> <head> <meta charset="utf-8"> <title>The website of a beginning coder</title> <link rel="stylesheet" href="style.css"> </head> <body> <header> <h1>The website of a beginning coder</h1> </header> <main> <nav> <h2>Recent Posts</h2> <ul> <!-- Add a link in the line below --> <li>Day One. How I forgot to feed the cat</li> <li>Day Two. I want to become a coder</li> <li>Day Three. My cat is offended at me</li> <li>Day Four. How I almost got sick</li> <li>Day Five. I am relaxing</li> <li>Day Six. How I failed to understand anything</li> <li>Day Seven. Muffin gave me an assignment</li> <li>Day Eight. It’s getting very serious</li> <li>Day Nine. Or more precisely night</li> <li>Day Ten. Summing up</li> <li>Day Eleven. Everything should be taken in moderation</li> </ul> </nav> <section> <p>Greetings to everyone! Welcome to my first site. Up until just recently I had no idea what a coder does for a living, but now I have found interactive courses in HTML and CSS and I have set myself the goal of becoming one. I even was assigned an instructor, Muffin, who does not allow me to slack off and will track my progress.</p> <p>My first assignment is to keep a diary and honestly write about all of my accomplishments.</p> </section> <section> Skills section </section> </main> <footer> Website footer </footer> </body> </html>
CSS
body { padding: 0 30px; font-size: 14px; line-height: 22px; font-family: "Georgia", serif; color: #222222; } h1 { font-size: 36px; line-height: normal; } h2 { font-size: 20px; line-height: normal; } a { color: #0099ef; text-decoration: underline; } ul { list-style: none; padding-left: 0; } footer { margin-top: 30px; }

What didn’t you like in this task?

Thanks! We’ll fix everything at once!

The code has changed, click “Refresh” or turn autorun on.

You’ve gone to a different page

Click inside the mini-browser to shift the focus onto this window.

100%
Goalscompleted
0
    1. Wrap all of the text inside the first list item in the <a> tag.
    2. Add the attribute href with the address day-1.html to the link.
    3. Now click on the link (in the mini-browser).

    Cookies ∙ Privacy ∙ License Agreement ∙ About ∙ Contacts ∙ © HTML Academy OÜ, 2019−2025

    VISAMastercard

    Log in

    or

    Forgot your password?

    Sign up

    Sign up

    or
    Log in

    Restore access

    Have you forgotten your password or lost access to your profile? Enter your email connected to your profile and we will send you a link to restore access.

    Forgot to connect your email to the profile? Email us and we’ll help.