Horje
HTML height Attribute

Definition and Usage

The height attribute specifies the height of the element, in pixels.


Applies to

The height attribute can be used on the following elements:

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

Browser Support

The height attribute has the following browser support for each element.


How to add A <canvas> element with a height and width of 200 pixels

Canvas Example.
index.html
Example: HTML
 <canvas id="myCanvas" width="200" height="200" style="border:1px solid"> 

Output should be:

How to add A <canvas> element with a height and width of 200 pixels

How to add A flash animation with a height and width of 200 pixels

Embed Example.
index.html
Example: HTML
 <embed src="helloworld.swf" width="200" height="200"> 

Output should be:

How to add A flash animation with a height and width of 200 pixels

How to add An <iframe> with a specified height and width of 200 pixels

Iframe Example.
index.html
Example: HTML
 <iframe src="https://horje.com" width="200" height="200">
</iframe> 

Output should be:

How to add An <iframe> with a specified height and width of 200 pixels

How to add An image with a height and width of 42 pixels

Img Example.
index.html
Example: HTML
 <img src="smiley.gif" alt="Smiley face" height="42" width="42"> 

Output should be:

How to add An image with a height and width of 42 pixels

How to Define an image as the submit button, with height and width attributes

Input Example.
index.html
Example: HTML
<form action="/action_page.php">
  <label for="fname">First name:</label>
  <input type="text" id="fname" name="fname"><br><br>
  <label for="lname">Last name:</label>
  <input type="text" id="lname" name="lname"><br><br>
  <input type="image" src="https://horje.com/avatar.png" alt="Submit" width="48" height="48">
</form>

Output should be:

How to Define an image as the submit button, with height and width attributes

How to add A flash animation with a height and width of 400 pixels

Object Example.
index.html
Example: HTML
<object data="https://horje.com/avatar.png" width="300" height="200"></object>

Output should be:

How to add A flash animation with a height and width of 400 pixels

How to add A video player with a specified height and width

Video Example.
index.html
Example: HTML
<video width="320" height="240" controls>
  <source src="https://www.sample-videos.com/video321/mp4/240/big_buck_bunny_240p_2mb.mp4" type="video/mp4">
  <source src="https://www.sample-videos.com/video321/mp4/240/big_buck_bunny_240p_2mb.mp4" type="video/ogg">
  Your browser does not support the video tag.
</video>

Output should be:

How to add A video player with a specified height and width




html height attribute

Type:
Develop
Category:
Web Tutorial
Sub Category:
HTML Attribute
Uploaded by:
Admin


Read Article
https://develop.horje.com/learn/1434/reference