Images

Now let's look at another important component of web pages. Images. In the previous lesson, we saw that there is a special element br, which consists only of an opening tag. An image is another such element. An image is created as follows:

<img src="image-link">

As we can see, an image is created using the img element, with the src attribute, where the value of this attribute is the link to the image. Similar to hyperlinks (the a element), we can use both absolute and relative links.

We said that when the link looks like this: ./dog.html, the ./ means in the folder where this HTML file is located, find the following file: dog.html

However, a relative link can also start without a dot, for example: /dog.html. Without a dot, it means find the file dog.html in the root folder of the project.

Instructions

In the file index.html, right below the first-level heading (the h1 element), create an img element with the src attribute, with the value /learn/html/cats.webp

Start programming for free

By signing up, you agree to the Terms of Service and Privacy Policy.

Or sign up with:

5/10

Images | Start Coder