HTML - attributes - height

revision:


Content

"height" attribute : specifies the height of an element in pixels syntax some examples


"height" attribute : specifies the height of an element in pixels

top

The height attribute can be used on the following elements: <canvas>, <embed>, <iframe>, <img>, <input>, <object>, <video>.


syntax

top

<canvas height="pixels | %"></ >

<embed height="pixels | %"></ >

<iframe height="pixels | %"></ >

<img height="pixels | %"></ >

<input height="pixels | %"></ >

<object height="pixels | %"></ >

<video height="pixels | %"></ >

Attribute values:

pixels: it sets the height of the cell in terms of pixels.
%: it sets the height of the cell in terms of percentage (%).


some examples

top
Your browser does not support the HTML5 canvas tag.
codes:
                    <canvas id="myCanvas" width="200" height="200" style="border:1px solid; margin-left: 3vw;">
                        Your browser does not support the HTML5 canvas tag.
                    </canvas>
                    <script>
                        var c = document.getElementById("myCanvas");
                        var ctx = c.getContext("2d");
                        ctx.fillStyle = "#92B901";
                        ctx.fillRect(50, 50, 100, 100);
                    </script>
                
codes
                    <iframe src="../../pics/car2.jpg" width="400" height="200" style="margin-left: 3vw;">
                        <p>Your browser does not support iframes.</p>
                    </iframe>