12-HTML Images

0
286

This tutorial is all about HTML Images.
Images are defined with the  <img> tag in HTML. This  <img> tag is empty and does not have a closing tag, but it only contains attribute.

 

The src attribute is the one that specifies the URL (location) of an image

example:

<img src=”url” alt=”name here” />

 

The alt attribute is the one that specifies an alternate text for an image, if it cannot be displayed. It also provides alternative text if the src attribute has an error due to slow connection.

example:

name here

 

The style attribute is used to specify the width and height of an image.

 

<img src=”url” alt=”name here” style=”width:100px;height:100px;” />

 

 

or you can use this instead.

 

<img src=”url” alt=”name here” width=”100″ height=”100″ / >

 

To put a link into an image, simply place the tag inside the tag.
Example:

 

<a href=”http://itsourcecode.com/”>
<img src=”http://itsourcecode.com/wp-content/uploads/2015/10/cropped-ITSourceCodeLogo1-300×300.png” alt=”ITSourceCodeLogo.png” width=”300″ height=”300″ style=”width:100px;height:100px;” />
</a>

 

Result:


ITSourceCodeLogo.png

 

 

 

 

Readers might read also:

 

Facebook Comments
(Visited 22 times, 1 visits today)

LEAVE A REPLY

Please enter your comment!
Please enter your name here