How to use image height and width attribute in HTML Page?

HTMLWeb DevelopmentFront End Technology

To add an image in an HTML page, <img> tag is used. With that, we need to use the attributes height and width to set the height and width of the image in pixels. Just keep in mind to specify both these attributes.

HTML Attribute

Example

You can try the following code to add height and width attribute to the image in an HTML page −

<!DOCTYPE html>
<html>
   <head>
      <title>HTML Document</title>
   </head>

   <body>
      <img src = ”/green/images/logo.png” alt = "We Learners" width = ”170” height = ”70”>
   </body>
</html>
raja
Published on 18-Jan-2018 10:03:59
Advertisements