html tutorial - height Attribute in HTML - html5 - html code - html form



Height attribute in html

Learn html - html tutorial - Height attribute in html - html examples - html programs

Syntax for height attribute in HTML:

<img height="pixels">

Differences between HTML 4.01 and HTML 5 for height Attribute:

HTML 4.01

  • The <canvas>, <embed> and <video> tag are not supported in HTML4.
  • For the <iframe> tag, the height should be defined in pixels or in % of the containing element.

HTML 5

Applies To:

Element Attribute
<canvas> height
<embed> height
<iframe> height
<img> height
<input> height
<object> height
<video> height

height Attribute Value in HTML:

Value Description
pixels Specifies the height of the elements.

Sample Coding for height Attribute in HTML:

Tryit<!DOCTYPE html>
<html>
    <head>
        <title>Wikitechy HTML height Attribute</title>
    </head>
    <body>
        <img src="https://www.wikitechy.com/images/logo.png" height="100" 
        width="200">
    </body>
</html>

Code Explanation for height Attribute in HTML:

height Attribute Code Explanation

  1. The height attribute specifies the height of the image is 100px.

Output for height Attribute in HTML:

height Attribute Output

  1. The height of the output image is 100px.

Browser Support for height Attribute in HTML:

Element
<canvas> 4 9 2 3.1 9
<embed> Yes Yes Yes Yes Yes
<iframe> Yes Yes Yes Yes Yes
<img> Yes Yes Yes Yes Yes
<input> 1 Yes 16 Yes 1
<object> Yes Yes Yes Yes Yes
<video> Yes Yes Yes Yes Yes

Related Searches to height Attribute in html