putting images in web pages improves the appearance and attracts the user to the page.
<img src="http://www.learnsimpli.com/wp-content/uploads/2019/12/HTML.png" alt="HTML Tutorial">
HTML Images Syntax: In HTML, images are defined with the <img> tag. The <img> tag is empty, it contains attributes only, and does not have a closing tag.
The src attribute specifies the URL (web address) of the image
<img src="url">
The alt Attribute: provides an alternate text for an image, if the user for some reason cannot view it (because of slow connection, an error in the src attribute, or if the user uses a screen reader).
The value of the alt attribute should describe the image
<img src="http://www.learnsimpli.com/wp-content/uploads/2019/12/HTML.png" alt="Online free learning tutorial">
Image Size – Width and Height: You can use the style attribute to specify the width and height of an image.
<img src="http://www.learnsimpli.com/wp-content/uploads/2019/12/HTML.png" style="width:500px;height:600px;">
Images in Another Folder: the first browser searches images in the same folder of the web page if not we can give the link of the address where the image is stored. However, it is common to store images in a sub-folder. You must then include the folder name in the src attribute
<img src="/images/image1.jpg" alt="HTML5 Icon" style="width:128px;height:128px;">
Background Image in HTML To add a background image on an HTML element, you can use the style attribute
<div style="background-image: url('img_girl.jpg');">
One thought on “HTML IMAGES”
Comments are closed.