Monday, October 14, 2019

How to Insert Image in HTML

How to Insert image on Web Pages

Images enhance visual appearance of the web pages by making them more interesting and colorful.

The <img> tag is used to insert images in the HTML documents. It is an empty element and contains attributes only. 
The syntax of the <img> tag can be given with:
<img src="urlalt="some_text">
Each image must carry at least two attributes: the src attribute, and an alt attribute.
The src attribute tells the browser where to find the image. Its value is the URL of the image file.
 the alt attribute provides an alternative text for the image, if it is unavailable or cannot be displayed for some reason. Its value should be a meaningful substitute for the image.

Set the Width and Height of an Image

The width and height attributes are used to specify the width and height of an image.
The values of these attributes are interpreted in pixels by default.
<img src="dog.jpg" alt="dogs" width="300" height="300">
You can also use the style attribute to specify width and height for the images.
<img src="dog.jpg" alt="dogs" style="width: 300px; height: 300px;">

source code :
<html>
<head>
<title>Sample</title>
</head>
<body>
<h1>image </h1>
<img src ="dog.jpg"alt="dog" height="300px" width="350px"/>
</body>
</html>
output:










Yash Talaiche

Author & Editor

Yash Talaiche , Python Developer |PHP|CSS|HTML|SQL|DJANGO|AUTONATION , Working on Django and Flask

0 comments:

Post a Comment