Html-img-tag
提供:Dev Guides
HTML-<img>タグ
説明
HTML <img>タグは、HTMLドキュメントに画像を配置するために使用されます。
例
<!DOCTYPE html>
<html>
<head>
<title>HTML Tag</title>
</head>
<body>
<img src = "https://www.finddevguides.com/images/html.gif"
alt = "HTML Tutorial" height = "150" width = "140"/>
</body>
</html>
これは、次の結果を生成します-
グローバル属性
このタグは、− link:/html/html_attributes_reference [HTML属性リファレンス]で説明されているすべてのグローバル属性をサポートします
特定の属性
HTML <img>タグは、次の追加属性もサポートしています-
Attribute | Value | Description |
---|---|---|
align | top bottom middle left right | Deprecated− Specifies the alignment for the image. |
alt | text | Specifies alternate text |
border | pixels | Deprecated − Specifies the width of the image border. |
crossoriginhtml-5 | anonymous use-credentials | It allows images from third-party sites that allow cross-origin access to be reused with canvas. |
height | pixels or % | Specifies the height of the image. |
hspace | pixels | Deprecated − Amount of white space to be inserted to the left and right of the object. |
ismap | URL | Defines the image as a server-side image map. |
longdesc | text | Deprecated − Specifies a URI/URL of a long description - this can elaborate on a shorter description specified with the alt attribute. |
src | URL | the url of an image |
usemap | #mapname | Defines the image as a client-side image map and used alongwith <map> and <area> tags. |
vspace | pixels | Deprecated − Amount of white space to be inserted to the top and bottom of the object. |
width | pixels or % | Sets the width of an image in pixels or in %. |
イベント属性
このタグは、− link:/html/html_events_reference [HTMLイベントリファレンス]で説明されているすべてのイベント属性をサポートします。
ブラウザのサポート
Chrome | Firefox | IE | Opera | Safari | Android |
---|---|---|---|---|---|
Yes | Yes | Yes | Yes | Yes | Yes |