Aligning an Image
Aligning an image in HTML involves using the align attribute within the <img> tag to position it horizontally. Options include left, right, or center, enhancing page layout and visual appeal. Please refer to the HTML | <img> align Attribute for further details.
Example: In this example we aligns an image to the right using the “align” attribute within the <img> tag. It positions the w3wiki logo for visual enhancement.
<!DOCTYPE html>
<html>
<head>
<title>Aligning an image</title>
</head>
<body>
<p>Aligning an Image</p>
<img
src="https://media.w3wiki.org/wp-content/cdn-uploads/20190710102234/download3.png"
alt="w3wiki logo"
align="right" />
</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