Atrybut wysokości HTML


Definicja i użycie

heightAtrybut określa wysokość elementu w pikselach .


Dotyczy

Atrybutu heightmożna użyć na następujących elementach:

Elementy Atrybut
<płótno> wzrost
<embed> wzrost
<iframe> wzrost
<img> wzrost
<wejście> wzrost
<obiekt> wzrost
<wideo> wzrost

Przykłady

Przykład płótna

Element <canvas> o wysokości i szerokości 200 pikseli:

<canvas id="myCanvas" width="200" height="200" style="border:1px solid">

Przykład osadzania

Animacja flash o wysokości i szerokości 200 pikseli:

<embed src="helloworld.swf" width="200" height="200">

Przykład iframe

<iframe> o określonej wysokości i szerokości 200 pikseli:

<iframe src="/default.asp" width="200" height="200">
</iframe>

Przykład obrazu

Obraz o wysokości i szerokości 42 pikseli:

<img src="smiley.gif" alt="Smiley face" height="42" width="42">

Przykład wejścia

Zdefiniuj obraz jako przycisk przesyłania z atrybutami wysokości i szerokości:

<form action="/action_page.php">
  First name: <input type="text" name="fname"><br>
  Last name: <input type="text" name="lname"><br>
  <input type="image" src="img_submit.gif" alt="Submit" width="48" height="48">
</form>

Przykład obiektu

Animacja flash o wysokości i szerokości 400 pikseli::

<object data="helloworld.swf" height="400" width="400"></object>

Przykład wideo

Odtwarzacz wideo o określonej wysokości i szerokości:

<video width="320" height="240" controls>
  <source src="movie.mp4" type="video/mp4">
  <source src="movie.ogg" type="video/ogg">
  Your browser does not support the video tag.
</video>

Obsługa przeglądarki

heightAtrybut ma następującą obsługę przeglądarki dla każdego elementu :

Element
canvas 4.0 9.0 2.0 3.1 9.0
embed Yes Yes Yes Yes Yes
iframe Yes Yes Yes Yes Yes
img Yes Yes Yes Yes Yes
input 1.0 Yes 16.0 Yes 1.0
object Yes Yes Yes Yes Yes
video Yes Yes Yes Yes Yes