Referenz:HTML/img

Aus SELFHTML-Wiki
Wechseln zu: Navigation, Suche
Name img HTML5 HTML 4.0
Bedeutung ermöglicht es, Bilddateien in einem Dokument darzustellen
Syntax Start-Tag: notwendig
End-Tag: verboten
<img>
optionale Tags

{{{optional}}}

WAI-ARIA-Rolle
  • img
  • presentation, falls es kein oder ein leeres alt-Attribut besitzt
  • allen Elementen, die fließenden Inhalt erlauben
  • allen Stil-Elementen
Info: Elemente, die fließenden Inhalt erlauben (flow content expected)Info: Elemente, die fließenden Inhalt erlauben (flow content expected)

Information: Elemente, die fließenden Inhalt erlauben

Info: Stil-Elemente (phrasing content)Info: Stil-Elemente (phrasing content)

Information: Stil-Elemente

Elternelemente Darf vorkommen in:
erlaubte Inhalte

keine, leeres Element

Browsersupport
  • Chrome
  • Firefox
  • IE
  • Opera
  • Safari
Spezifikation W3c logo klein.gif img-element
Beachten Sie

In XHTML benötigt das img-Tag den schließenden Schrägstrich ( / ).

Tipp
Validität Prüfen Sie, ob Ihr Markup valide ist, falls Sie sich nicht sicher sind.
Attribute
Name Inhalt Standardwert Bedeutung
Universalattribute
id ID identifiziert ein einziges Element innerhalb eines Dokuments
class CDATA ordnet ein Element einer oder mehreren Klassen zu.
accesskey ID Tastaturkürzel
contenteditable CDATA editierbarer Inhalt
contextmenu definiert Kontextmenü
dir ltr, rtl definiert die Schreibrichtung innerhalb des Dokuments
draggable ID kann mit Drag & Drop gezogen werden
dropzone CDATA Aktion bei Ablegen
hidden versteckter Inhalt
lang NAME legt eine den IANA-Sprachdefinitionen folgende Sprache des Elementinhalts fest [RFC1766]
spellcheck ID Rechtschreibprüfung
style CDATA notiert direkt in einem Element- style sheet data
tabindex NAME zeigt an, ob dieses Element fokusiert werden kann, ob es mithilfe der Tastaturnavigation angesteuert werden kann und in welcher Reihenfolge navigiert wird.
title CDATA betitelt oder beschreibt ein Element.
alt CDATA legt eine kurze Beschreibung des Bildes fest, die angezeigt wird, wenn das Bild aus irgendwelchen Gründen nicht angezeigt werden kann.
height CDATA Höhe in CSS-Pixel.
ismap Boolesches Attribut gibt an, dass dieses Element Zugriff auf eine Server-seitige Image-Map bietet.
src CDATA bestimmt die URI-Adresse des Bilds, das eingebettet werden soll.
usemap CDATA Hash(#) Name des Map-Elements mit dem dieses Element in Verbindung steht.
width CDATA Breite in CSS-Pixel.

Attribut: Pflichtattribut
Attribut: optionales Attribut


HTML 4.01 Strict[Bearbeiten]

Bedeutung Embedded image
Tags Start-Tag: notwendig
End-Tag: verboten

<img>

Elternelemente Darf vorkommen in:

a, abbr, acronym, address, b, bdo, big, button, caption, cite, code, dd, del, dfn, div, dt, em, fieldset, h1, h2, h3, h4, h5, h6, i, ins, kbd, label, legend, li, object, p, q, samp, small, span, strong, sub, sup, td, th, tt, var

Kindelemente
Attribute
Name Inhalt Standardwert Bedeutung
Universalattribute
id ID document-wide unique id
class CDATA space-separated list of classes
style CDATA associated style info - style sheet data
title CDATA advisory title
lang NAME language code - a language code, as per [RFC1766]
dir ltr, rtl direction for weak/neutral text
onclick CDATA a pointer button was clicked - script expression
ondblclick CDATA a pointer button was double clicked - script expression
onmousedown CDATA a pointer button was pressed down - script expression
onmouseup CDATA a pointer button was released - script expression
onmouseover CDATA a pointer was moved onto - script expression
onmousemove CDATA a pointer was moved within - script expression
onmouseout CDATA a pointer was moved away - script expression
onkeypress CDATA a key was pressed and released - script expression
onkeydown CDATA a key was pressed down - script expression
onkeyup CDATA a key was released - script expression
src CDATA Pflichtattribut URI of image to embed - a Uniform Resource Identifier, see [URI]
alt CDATA Pflichtattribut short description
longdesc CDATA link to long description (complements alt) - a Uniform Resource Identifier, see [URI]
name CDATA name of image for scripting
height CDATA override height - nn for pixels or nn% for percentage length
width CDATA override width - nn for pixels or nn% for percentage length
usemap CDATA use client-side image map - a Uniform Resource Identifier, see [URI]
ismap ismap use server-side image map


HTML 4.01 Transitional[Bearbeiten]

Bedeutung Embedded image
Tags Start-Tag: notwendig
End-Tag: verboten

<img>

Elternelemente Darf vorkommen in:

a, abbr, acronym, address, applet, b, bdo, big, blockquote, body, button, caption, center, cite, code, dd, del, dfn, div, dt, em, fieldset, font, form, h1, h2, h3, h4, h5, h6, i, iframe, ins, kbd, label, legend, li, noframes, noscript, object, p, q, s, samp, small, span, strike, strong, sub, sup, td, th, tt, u, var

Kindelemente
Attribute
Name Inhalt Standardwert Bedeutung
Universalattribute
id ID document-wide unique id
class CDATA space-separated list of classes
style CDATA associated style info - style sheet data
title CDATA advisory title
lang NAME language code - a language code, as per [RFC1766]
dir ltr, rtl direction for weak/neutral text
onclick CDATA a pointer button was clicked - script expression
ondblclick CDATA a pointer button was double clicked - script expression
onmousedown CDATA a pointer button was pressed down - script expression
onmouseup CDATA a pointer button was released - script expression
onmouseover CDATA a pointer was moved onto - script expression
onmousemove CDATA a pointer was moved within - script expression
onmouseout CDATA a pointer was moved away - script expression
onkeypress CDATA a key was pressed and released - script expression
onkeydown CDATA a key was pressed down - script expression
onkeyup CDATA a key was released - script expression
src CDATA Pflichtattribut URI of image to embed - a Uniform Resource Identifier, see [URI]
alt CDATA Pflichtattribut short description
longdesc CDATA link to long description (complements alt) - a Uniform Resource Identifier, see [URI]
name CDATA name of image for scripting
height CDATA override height - nn for pixels or nn% for percentage length
width CDATA override width - nn for pixels or nn% for percentage length
usemap CDATA use client-side image map - a Uniform Resource Identifier, see [URI]
ismap ismap use server-side image map
align (top, middle, bottom, left, right) vertical or horizontal alignment - center?
border CDATA link border width - integer representing length in pixels
hspace CDATA horizontal gutter - integer representing length in pixels
vspace CDATA vertical gutter - integer representing length in pixels


HTML 4.01 Frameset[Bearbeiten]

Bedeutung Embedded image
Tags Start-Tag: notwendig
End-Tag: verboten

<img>

Elternelemente Darf vorkommen in:

a, abbr, acronym, address, applet, b, bdo, big, blockquote, body, button, caption, center, cite, code, dd, del, dfn, div, dt, em, fieldset, font, form, h1, h2, h3, h4, h5, h6, i, iframe, ins, kbd, label, legend, li, noscript, object, p, q, s, samp, small, span, strike, strong, sub, sup, td, th, tt, u, var

Kindelemente
Attribute
Name Inhalt Standardwert Bedeutung
Universalattribute
id ID document-wide unique id
class CDATA space-separated list of classes
style CDATA associated style info - style sheet data
title CDATA advisory title
lang NAME language code - a language code, as per [RFC1766]
dir ltr, rtl direction for weak/neutral text
onclick CDATA a pointer button was clicked - script expression
ondblclick CDATA a pointer button was double clicked - script expression
onmousedown CDATA a pointer button was pressed down - script expression
onmouseup CDATA a pointer button was released - script expression
onmouseover CDATA a pointer was moved onto - script expression
onmousemove CDATA a pointer was moved within - script expression
onmouseout CDATA a pointer was moved away - script expression
onkeypress CDATA a key was pressed and released - script expression
onkeydown CDATA a key was pressed down - script expression
onkeyup CDATA a key was released - script expression
src CDATA Pflichtattribut URI of image to embed - a Uniform Resource Identifier, see [URI]
alt CDATA Pflichtattribut short description
longdesc CDATA link to long description (complements alt) - a Uniform Resource Identifier, see [URI]
name CDATA name of image for scripting
height CDATA override height - nn for pixels or nn% for percentage length
width CDATA override width - nn for pixels or nn% for percentage length
usemap CDATA use client-side image map - a Uniform Resource Identifier, see [URI]
ismap ismap use server-side image map
align (top, middle, bottom, left, right) vertical or horizontal alignment - center?
border CDATA link border width - integer representing length in pixels
hspace CDATA horizontal gutter - integer representing length in pixels
vspace CDATA vertical gutter - integer representing length in pixels


XHTML 1.0 Strict[Bearbeiten]

Bedeutung
Tags Start-Tag: notwendig
End-Tag: leer

<img />
<img></img>

Elternelemente Darf vorkommen in:

a, abbr, acronym, address, b, bdo, big, button, caption, cite, code, dd, del, dfn, div, dt, em, fieldset, h1, h2, h3, h4, h5, h6, i, ins, kbd, label, legend, li, object, p, q, samp, small, span, strong, sub, sup, td, th, tt, var

Kindelemente
Attribute
Name Inhalt Standardwert Bedeutung
Universalattribute
id ID
class CDATA
style CDATA
title CDATA
lang NMTOKEN
xml:lang NMTOKEN
dir ltr, rtl
onclick CDATA
ondblclick CDATA
onmousedown CDATA
onmouseup CDATA
onmouseover CDATA
onmousemove CDATA
onmouseout CDATA
onkeypress CDATA
onkeydown CDATA
onkeyup CDATA
src CDATA Pflichtattribut
alt CDATA Pflichtattribut
longdesc CDATA
height CDATA
width CDATA
usemap CDATA
ismap ismap


XHTML 1.0 Transitional[Bearbeiten]

Bedeutung
Tags Start-Tag: notwendig
End-Tag: leer

<img />
<img></img>

Elternelemente Darf vorkommen in:

a, abbr, acronym, address, applet, b, bdo, big, blockquote, body, button, caption, center, cite, code, dd, del, dfn, div, dt, em, fieldset, font, form, h1, h2, h3, h4, h5, h6, i, iframe, ins, kbd, label, legend, li, noframes, noscript, object, p, q, s, samp, small, span, strike, strong, sub, sup, td, th, tt, u, var

Kindelemente
Attribute
Name Inhalt Standardwert Bedeutung
Universalattribute
id ID
class CDATA
style CDATA
title CDATA
lang NMTOKEN
xml:lang NMTOKEN
dir ltr, rtl
onclick CDATA
ondblclick CDATA
onmousedown CDATA
onmouseup CDATA
onmouseover CDATA
onmousemove CDATA
onmouseout CDATA
onkeypress CDATA
onkeydown CDATA
onkeyup CDATA
src CDATA Pflichtattribut
alt CDATA Pflichtattribut
name NMTOKEN
longdesc CDATA
height CDATA
width CDATA
usemap CDATA
ismap ismap
align (top, middle, bottom, left, right)
border CDATA
hspace CDATA
vspace CDATA


XHTML 1.0 Frameset[Bearbeiten]

Bedeutung
Tags Start-Tag: notwendig
End-Tag: leer

<img />
<img></img>

Elternelemente Darf vorkommen in:

a, abbr, acronym, address, applet, b, bdo, big, blockquote, body, button, caption, center, cite, code, dd, del, dfn, div, dt, em, fieldset, font, form, h1, h2, h3, h4, h5, h6, i, iframe, ins, kbd, label, legend, li, noscript, object, p, q, s, samp, small, span, strike, strong, sub, sup, td, th, tt, u, var

Kindelemente
Attribute
Name Inhalt Standardwert Bedeutung
Universalattribute
id ID
class CDATA
style CDATA
title CDATA
lang NMTOKEN
xml:lang NMTOKEN
dir ltr, rtl
onclick CDATA
ondblclick CDATA
onmousedown CDATA
onmouseup CDATA
onmouseover CDATA
onmousemove CDATA
onmouseout CDATA
onkeypress CDATA
onkeydown CDATA
onkeyup CDATA
src CDATA Pflichtattribut
alt CDATA Pflichtattribut
name NMTOKEN
longdesc CDATA
height CDATA
width CDATA
usemap CDATA
ismap ismap
align (top, middle, bottom, left, right)
border CDATA
hspace CDATA
vspace CDATA