Thursday, 19 November 2020

#11 HTML Images

Images in a website play an important role in attracting users.

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.  


=======================================================================

📌Here is the Codepen link to the above examples:- ðŸ”—https://codepen.io/arwazkhan189/pen/vYKwyWO

Next, we will learn about HTML Tables ...

Keep Learning and practice, practice, and practice.. !!!

Follow me on Codepen ðŸ”—https://codepen.io/arwazkhan189

LIKE, COMMENT, SHARE, SUBSCRIBE to the Blog!

No comments:

Post a Comment