Previous task
Introduction to HTML and CSS6/13
Back to the list of tasks
  1. 1. Let's Go!
  2. 2. CSS in action
  3. 3. Consolidation
  4. 4. HTML basics
  5. 5. Single HTML tags
  6. 6. Attributes of HTML tags
  7. 7. Looking for errors in HTML
  8. 8. Basics of CSS
  9. 9. Other ways to connect CSS
  10. 10. CSS selectors
  11. 11. CSS classes
  12. 12. CSS properties and values
  13. 13. Looking for errors in CSS
Nest task
  • Courses
  • Sign up
  • Log in

Loading...
It will be ready in a few seconds.

  • Theory
  • Theory

Attributes of HTML tags

In the previous task, as you noticed, nothing happened after inserting the <img> tag into the code. Why did it happen?

Tags can have attributes. Some tags need attributes. For example, the <img> tag, which denotes an image. It is obligatory to specify the src attribute, which specifies the address of the image (otherwise the browser will not be able to load it).

A tag can have multiple attributes:

<tag-name attribute1="value1" attribute2="value2" ...>

Here are examples:

<p class="important">…</p>
<a class="external" href="https://mysite.com">…</a>
<img class="avatar" src="keks.png">

In this assignment, you will practice using tag attributes.

Don't forget the spaces between the tag name and attribute and the spaces between attributes.
  • index.html
  • style.css
HTML
<!DOCTYPE html> <html> <head> <title>Attributes of HTML tags</title> <link rel="stylesheet" href="style.css"> </head> <body> <h1>Instructor Cupcake</h1> <p>In future courses, you'll often get help from Instructor Cupcake. Let's give him a chance to introduce himself:</p> <img> <hr> <blockquote> <p>Hi, my name is Cupcake and I am your future instructor. I am a web developer. My most famous projects are:<br> Cat Energy blog,<br> HTML and CSS course,<br> JavaScript course.</p> <p>We'll see you in future courses!</p> </blockquote> </body> </html>
CSS
body { font-family: "Georgia", serif; } blockquote { margin: 1.5em 0; padding: 0.5em 15px; line-height: 1.5; background-color: #f9f9f9; border-left: 2px solid #cccccc; } /* Example of photo design */ .photocard { display: block; width: 300px; margin: 20px auto; border-radius: 10px; box-shadow: 0 0 5px #666666; }

The code has changed, click "Update" or enable autorun.

You have moved to another page

Click inside the mini-browser to highlight this window.

100%
GoalsCompleted
0
    1. Add the src attribute with the value keks.jpg to the img tag,
    2. and class attribute with the value photocard.

    © 2023-2024, codehero.pro