New Posts
Home / Web Designing / HTML / How to Use Img Tag in HTML.

How to Use Img Tag in HTML.

How to Use Img Tag in HTML.

In this article, we will learn How to use img tag and its properties, like alt, width, and height.  Image tag has no closing tag. It is an inline element. It can be used inside the paragraph and headings, etc. In old time images were used by HTML in 94 and 96. Now images are used by CSS. Do not use align image because it is removed in HTML5.

Img Tag

Inserting Images.

<!doctype html>

<head>

<title>Formatting page content</title>

</head>

<body>

<h1> About Image</h1>

<img src=”new-design.png”>

<p>Images are used to place on the web-page through the using of the img tag. Images are considered replaced content, that is the element is replaced with the asset it references. The image element has several important attributes. The href attribute is used to tell the browser where to find the image.</p>

</body>

</html>

Alt Tag.

If the path of image is not correct then image will not be displayed and alter text will be displayed. The alt attribute allows you to pass along descriptive text representing the image. This can be used by screen readers, or displayed in the event the image fails to load.

<!doctype html>

<head>

<title>Formatting page content</title>

</head>

<body>

<h1> About Image</h1>

<img src=”new-design.png”>

<h2>About Alt</h2>

<img src=”new-design.pn” alt=”using of alt”><br>

</body>

</html>

 About Size.

The width and height are optional and can be used to pass the dimensions of the image to the browser. The values of width and height can  be changed to force the browser to size the image differently from its native  size.

<! doctype html>

<head>

<title>Formatting page content</title>

</head>

<body>

<h1> About Image</h1>

<h2>About Size</h2>

<img src=”new-design.png” width=”600″ height=”300″>

</body>

</html>

 Inserting Image, Alt Tag and Width and Height.

<! doctype html>

<head>

<title>Formatting page content</title>

</head>

<body>

<h1> About Image</h1>

<img src=”new-design.png”>

<p>Images are used to place on the web-page through the using of the img tag. Images are considered replaced content, that is the element is replaced with the asset it references. The image element has several important attributes. The href attribute is used to tell the browser where to find the image. </p>

<h2>About Alt</h2>

<img src=”new-design.pn” alt=”using of alt”><br>

<p>The alt attribute allows you to pass along descriptive text representing the image. This can be used by screen readers, or displayed in the event the image fails to load.</p>

<img src=”new-design.png”>

<h2>About Size</h2>

<p>The width and height are optional and can be used to pass  the dimensions of the image to the browser. the values of width and height can  be changed to force the browser to size the image differently from it’s native  size.</p>

<img src=”new-design.png” width=”600″ height=”300″>

</body>

</html>

 

About imran

My Name Mohammad Ramzan Bhutto. Live in District Jacobabad, Sindh, Pakistan. I have started blogging on Information Technology, my selected areas are Online Business, Digital Marketing, Make Money Online.

Check Also

External Style Sheet

How to Use External Style Sheet. 

How to Use External Style Sheet. An External style sheet is simply texting files with …