HTML Images

HTML Tutorial

HTML Images

HTML Images are displayed using the <img> tag.
The <img> tag is self-closing and does not need an end tag.

The most important attribute is src, which specifies the path or URL of the image.

Basic Image Example


 

  • src → Image source

  • alt → Alternative text (shown if image fails to load and useful for SEO and accessibility)

Add Image Width and Height


 

Image from Website URL


 

Image with Border and Style


 

Responsive Image (Auto Resize)


 

Output Preview

  • First example → shows image with default size

  • Second example → shows image resized to 300×200 pixels

  • Third and styled examples → show image with effects

Useful Attributes Summary

AttributeDescription
srcSpecifies image source
altShows alternative text
widthSets width
heightSets height
styleAdds CSS styling

Images make a webpage visually appealing and help convey information more effectively.

You may also like...