top of page

HTML Images

<img src="logo.png" alt="elogic logo">

The HTML <img> tag is used to put an image in a web page.

Images are actually not inserted into a web page, images are linked to web pages. The <img> tag creates a  space for the referenced image.

The <img> tag is empty, it contains attributes only, and does not have a closing tag.

The <img> tag has two required attributes:

  • src -  path to the image

  • alt -  alternate text for the image

Style

Image size can be done by mentioning width and height directly inside the <img> tag also we can use the style element inside the <style. tag

​

<img src="logo.png" alt="logo width="500" height="600">

<!DOCTYPE html>
<html>
<head>
<style>
img {
 width: 100px;

  height: 100px;
}
</style>
</head>
<body>

<img src="logo.png" alt="logo">

</body>
</html>

bottom of page