HTML Academy
The figure and figcaption tags, demonstrative material
Links and images15/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
Summary of “Links and Images”
  • Sign up
  • Log in

Loading…
Everything will be ready in few seconds

  • Theory
  • Theory
  • Comments

Links with a blank href, title attribute

The photo pages contain links that lead users to the previous and next photo pages. What should we do with this link, for example, on the last photo page? After all, there is no next photo in this case. You can delete the entire link, or you can do something else.

The <a> tag can generally be used without an address, in other words, without the attribute href. This tag means “stub link, ” which under other conditions may become a normal link (for example, when we move from the last photo to the middle of the gallery). Often, stub links are used to show that we are on the current page:

<nav>
  <ul>
    <li><a>Page 1</a></li>
    <li><a href="2">Page 2</a></li>
    <li><a href="3">Page 3</a></li>
  </ul>
</nav>

When we remove the href attribute from the link, it is a best practice to leave a tooltip about why we did it. In addition, tooltips can also help to explain the purpose of otherwise-incomprehensible links and image links. You can leave a tooltip using the <1>title attribute. For example:

<a title="Well, what do you mean by back? You are on the first photo! ">Back</a>

The tooltip will appear when you hover the cursor over the link for a little while.

Now let’s modify the navigation on the last page of the gallery.

After completing this step, you can safely download the archive containing the Website of a Beginning Coder that we prepared.

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> <p>Blog</p> <nav> <a href="day-15.html">Return to entry</a> </nav> </header> <main> <article> <figure> <img src="files/muffin-3.jpg" width="486" height="315" alt="Muffin"> <figcaption>Muffin offers his praise for the significant learning progress that we have made.</figcaption> </figure> <nav class="pagination"> <a href="photo-2.html">&lt; Back</a> <!-- Modify this link --> <a href="#">Forward &gt;</a> </nav> </article> <aside> Your ad could go here </aside> </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: 20px; line-height: normal; } nav { color: #888888; } aside { margin: 20px 0; color: #c4c4c4; } a[href] { color: #0099ef; text-decoration-line: underline; } figure { margin-left: 0; margin-right: 0; } figure img { vertical-align: middle; border: 8px solid rgb(202, 224, 248); } figcaption { width: 502px; padding-bottom: 8px; font-size: 12px; letter-spacing: 0.02em; font-style: italic; text-align: center; background-color: rgb(202, 224, 248); } .pagination a { display: inline-block; margin-right: 30px; margin-bottom: 15px; } .pagination { text-align: center; }

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. Remove the attribute href from the link Forward.
    2. Then add the attribute title with the text This is the last photo in the gallery to it.

    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.