[go: up one dir, main page]

0% found this document useful (0 votes)
6 views1 page

HTML Images Guide

Uploaded by

hs6423841
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
6 views1 page

HTML Images Guide

Uploaded by

hs6423841
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 1

Defining Images in HTML

In HTML, images are defined using the <img> tag. This tag is used to embed an image in a

webpage.

It is a self-closing tag, meaning it does not need a closing tag. Here is the basic syntax:

<img src="image.jpg" alt="Description of image" width="300" height="200">

Key Attributes:

- src (source): The path to the image file (required).

- alt (alternative text): Text to display if the image cannot load (important for accessibility and SEO).

- width: The width of the image (optional, in pixels).

- height: The height of the image (optional, in pixels).

Example:

<!DOCTYPE html>

<html>

<head>

<title>Image Example</title>

</head>

<body>

<h1>My Favorite Dog</h1>

<img src="german-shepherd.jpg" alt="A brown German Shepherd" width="400" height="300">

<p>This is a picture of a German Shepherd.</p>

</body>

</html>

You might also like