
- HTML Tutorial
- HTML - Home
- HTML - Overview
- HTML - Basic Tags
- HTML - Elements
- HTML - Attributes
- HTML - Formatting
- HTML - Phrase Tags
- HTML - Meta Tags
- HTML - Comments
- HTML - Images
- HTML - Tables
- HTML - Lists
- HTML - Text Links
- HTML - Image Links
- HTML - Email Links
- HTML - Frames
- HTML - Iframes
- HTML - Blocks
- HTML - Backgrounds
- HTML - Colors
- HTML - Fonts
- HTML - Forms
- HTML - Embed Multimedia
- HTML - Marquees
- HTML - Header
- HTML - Style Sheet
- HTML - Javascript
- HTML - Layouts
- HTML References
- HTML - Tags Reference
- HTML - Attributes Reference
- HTML - Events Reference
- HTML - Fonts Reference
- HTML - ASCII Codes
- ASCII Table Lookup
- HTML - Color Names
- HTML - Entities
- HTML - Fonts Ref
- HTML - Events Ref
- MIME Media Types
- HTML - URL Encoding
- Language ISO Codes
- HTML - Character Encodings
- HTML - Deprecated Tags
How to use image height and width attribute in HTML Page?
Images make content more interesting by helping readers to understand the content better on the web page.
We can insert images into the HTML page. To insert image in an HTML page, use the <img> tags. It is an empty tag, containing only attributes since the closing tag is not required.
The src attribute is used to add the image source which is the URL of the image(location of the file). The alt attribute is for adding alternate text, width is for adding width, and height is for adding the height of the image.
We use style attribute to make changes in the size of the image that is height and width of the image.
Syntax
Following is the syntax to change the height and width of the image on an HTML page.
<img src="url" alt="some_text" width="" height="">
Example
In the following example program, we used style attribute to make a change in the height of the image.
<!DOCTYPE html> <html> <body> <img src="https://www.tutorialspoint.com/opencv/images/opencv-mini-logo.jpg" height="300px"> </body> </html>
Example
In the following example program, we used style attribute to make change in the width of the image.
<!DOCTYPE html> <html> <body> <img src=" https://www.tutorialspoint.com/opencv/images/opencv-mini-logo.jpg" width="500px"> </body> </html>
Example
In the following example program, we used style attribute to make change in both width and height of the image.
<!DOCTYPE html> <html> <body> <img src="https://www.tutorialspoint.com/opencv/images/opencv-mini-logo.jpg" height="200"width="400px"> </body> </html>
- Related Articles
- How to use height and width attributes in HTML?
- How to use href attribute in HTML Page?
- How to use floating image in HTML page?
- How to use an animated image in HTML page?
- How to set cell width and height in HTML?
- HTML width Attribute
- HTML width Attribute
- HTML height Attribute
- How to Insert an Image in HTML Page?
- How to use autocomplete attribute in HTML?
- How to use formnovalidate attribute in HTML?
- How to use formaction attribute in HTML?
- How to use formenctype attribute in HTML?
- How to use formtarget attribute in HTML?
- How to use multiple attribute in HTML?
