What is <img> tag and how is it used?

Experience Level: Junior
Tags: HTML

Answer

The <img> tag defines an image in an HTML page.

It has a two required attributes: src and alt.

src

  • is use for the URL of image
alt
  • is alternative text
  • use for when image can not be loaded on web page
Example

<img class="img-center" src="circleimg.png" alt="test-picture1" width="100" />

Comments

No Comments Yet.
Be the first to tell us what you think.
HTML for beginners
HTML for beginners

Are you learning HTML ? Try our test we designed to help you progress faster.

Test yourself