HTML Academy
Image link
Links and images14/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
Links with a blank href, title attribute
  • Sign up
  • Log in

Loading…
Everything will be ready in few seconds

  • Theory
  • Theory
  • Comments

The figure and figcaption tags, demonstrative material

In the selfie gallery, each small image preview refers to a separate “photo page”. This photo page contains a full-sized image and a description. It is a fairly stand-alone element, and later we will be able to insert it on any other page of the blog. How can we properly mark up such “pages”?

The <figure> tag is perfectly suited for this. This tag is suitable for any illustrative or demonstrative material that can be added to the content of the document. These materials can be graphs, images, code examples, tables, and so on.

Usually, this material is accompanied by an explanatory comment or “caption”. Another tag, <figcaption>, is intended to be used to mark up this comment. This is placed as the first or last element inside <figure>. For example:

<figure>
  Graph, image, diagram or code
  <figcaption>Caption for the content</figcaption>
</figure>

Let’s mark up the photo in our gallery using <figure>.

By default, the figure tag uses indents, so we added styles for figure and figcaption, which can be viewed in the tab style.css.

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="main.css"> </head> <body> <header> <p>Blog</p> <nav> <a href="day-15.html">Return to entry</a> </nav> </header> <main> <article> <!-- Wrap the image below using the figure tag --> <img src="files/muffin-1.jpg" width="486" height="315" alt="Muffin"> <nav class="pagination"> <a href="#">&lt; Back</a> <a href="photo-2.html">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; } 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. Wrap the image using the figure tag.
    2. Then add the description The vigilant instructor, Muffin, maintains order 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.