Setting style to the Image
In this example, we are using the border property to decorate the image. By default, every picture has a border around it. By using the border attribute, the thickness of the border can be changed. A thickness of “0” means that there will be no border around the picture. Please refer to the HTML | <img> border Attribute for further details.
Example: This example illustrates the use of style property inside the <img> tag in HTML.
<!DOCTYPE html>
<html>
<head>
<title>Setting border to image</title>
</head>
<body>
<p>Setting style to the Image</p>
<img src=
"https://media.w3wiki.org/wp-content/cdn-uploads/20190710102234/download3.png"
alt="w3wiki logo"
width="200"
height="200"
border="5" />
</body>
</html>
Output:
HTML Images
The HTML <img> tag is used to embed an image in web pages by linking them. It creates a placeholder for the image, defined by attributes like src, width, height, and alt, and does not require a closing tag.
There are 2 ways to insert the images into a webpage:
- By providing a full path or address (URL) to access an internet file.
- By providing the file path relative to the location of the current web page file.
We will first discuss inserting the image into the webpage & simultaneously, we will understand both the above approaches.
Contact Us