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


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

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

      <img src = ”/green/images/logo.png” alt = "We Learners" width = ”170” height = ”70”>
Updated on 22-Dec-2021 08:29:35