HTML height attribute
height
The purpose of the HTML height attribute is to specify the height of the element or frame.
Supported elements
HTML height attribute supports iframe, img and object elements.
Syntax
<ElementName height="value" >.....</ElementName>
Where ElementName is any supported elements.
Type of value
Length.
Value
Value | Description |
---|---|
A number | To specify length in pixels. |
A number followed by % (for example 20%) | To specify length in percentage (of available length). |
A relative length (for example cols=20%,*,20%) | For iframe. Where * indicated 60%(i.e. 100-[20+20]). |
Default value
There is no default value of HTML height attribute.
Supported doctypes
HTML 4.01 strict, HTML 4.01 transitional, HTML 4.01 frameset. For iframe, only HTML 4.01 transitional.
Example of HTML height attribute with img
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<title>Example of HTML height attribute with img</title>
</head>
<body>
<img src="coords-a.gif" width="308" height="190" alt="img height width example" />
</body>
</html>
Result
View this example in a separate browser window
Example of HTML height attribute with img
Example of HTML height attribute with iframe
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<title>Example of HTML height attribute with img</title>
</head>
<body>
<iframe src="../../sql/customer.php" width="100%" height="100%"></iframe>
</body>
</html>
Result
View this example in a separate browser window
Example of HTML height attribute with iframe
Previous: HTML headers attribute
Next: HTML href attribute
Test your Programming skills with w3resource's quiz.
It will be nice if you may share this link in any developer community or anywhere else, from where other developers may find this content. Thanks.
https://w3resource.com/html/attributes/html-height-attribute.php
- Weekly Trends and Language Statistics
- Weekly Trends and Language Statistics