Trusted answers to developer questions
Trusted Answers to Developer Questions

Related Tags

html
css
communitycreator

What are the height/width attributes in HTML?

Behzad Ahmad

Overview

In HTML, the height and width attributes are used to set the height and width of an element. We can define the height and width values in terms of pixels.

We can set the height of the image by using the <img> height attribute and width by using the <img> width attribute.

Example

The basic HTML code to demonstrate the use of the height/width attribute is as follows:

  • HTML
Using the "width" and "height" tag

Explanation

In this example, we can see that we set the height and width of the image. We can also set the height and width according to our own choice.

RELATED TAGS

html
css
communitycreator
RELATED COURSES

View all Courses

Keep Exploring