HTML Images
The HTML <img> tag is used to embed an image in web page.
syntax:- <img src='path of the image' alt='alternate text for the image'>
HTML Images - src Attribute
The src attribute specifies the path (URL) to the image.
HTML Images - alt Attribute
The alt attribute provides alternate text for an image if the user somehow cannot view the image then the alternate text will be displayed.
⭐Example of an HTML Images :
❗ If the user for some reason cannot view the image then the alternate text will be displayed.
HTML Images - width and Height
We can specify the width and the height attribute to give a size an image. The width and height attributes define the width and height of the images in pixels.
syntax:- <img src='url' alt='alternate-text' width='200' height='300'>
⭐Example of an HTML image with width and height attributes :
❗ We can style the images using CSS like background images etc. It will be discussed further.
No comments:
Post a Comment