HTML width and height Attribute
The width and height Attribute is used to adjust the width and height of an image(in pixels).
Example: This example explains the HTML width & height Attributes to specify the different sizes of the images.
<!DOCTYPE html>
<html lang="en">
<head>
<title>Width and Height</title>
</head>
<body>
<img src=
"https://media.w3wiki.org/wp-content/cdn-uploads/Geek_logi_-low_res.png"
width="300px"
height="100px">
</body>
</html>
Output:
HTML Attributes
HTML attributes provide additional information about elements within an HTML document. Every HTML element can have attributes. Attributes are always defined in the start tag. They are specified using a name/value pair format, where the attribute name defines the property, and its value provides specific details, like name=”value”. These attributes impact content display and interaction on web pages.
Let’s explore the key aspects of HTML attributes:
Table of Content
- HTML Global Attributes
- HTML src Attribute
- HTML alt Attribute
- HTML width and height Attribute
- HTML id Attribute
- HTML title Attribute
- HTML href Attribute
- HTML style Attribute
- HTML lang attribute