Insert Images in HTML | HTML Images | Learn HTML

HTML Images

Html Images plays an key role in any websites and it’s design. It can help the visitors of the websites to connect and feel comfortable on the website. In the world, 65% of population are visual learners. In HTML, <img> tag is used to display the images in the web pages. It requires the two important attributes: alt (Alternate Text) and src (Source of Image or Picture).

HTML Images | Image Tag | Tech-Mirror
HTML Images | Image Tag | Tech-Mirror

The alt attribute plays a key role when browser cannot not find the images or due to some reason. The text which you write in “alt” attribute is displayed when image is loading or not displayed due to some reason.

The src attribute is used to specify the URL of image. The browsers load the image in the web page which specifies in the SRC attribute. There are basically two types of URL which are used by the SRC attribute.

1) Absolute URL: It is used when you want to display the image in your webpage which is hosted on other website.

Example:

2) Relative URL: It is relative to either current domain or the current page. It does not contain any domain name.

Example:

When you will use slash (/) in the begin in your URL, It means that it is relative to current domain. If you begin your URL without slash (“/”), It means that it is relative to current page.

Syntax :

<img> tag is supported by the all major browsers and It also supports the all major image formats like JPEG, PNG, GIF(Including Animated GIF), BMP, TIFF and SVG.

If you use the “wrong” image file format, you’ll end up with images that either don’t look good, or that are too large and waste bandwidth or not found image.


Also Check HTML Styles

Leave a Reply

Your email address will not be published. Required fields are marked *