Matthias Apsel: Breite / Höhe div auslesen

Beitrag lesen

Hallo Gunnar Bittersmann,

Es wird grundsätzlich das ausgelesen, was im style-Attribut steht.

Nein.

Doch.

Oh.

Wenn du in den Inspektor guckst, stellst du fest, dass du in Zeile 2 den Wert des style-Attributs änderst.

Genau genommen ändert man eine Eigenschaft des style-Objekts des Elementobjekts im DOM. (Und ja, das Entwicklertool stellt das als Attribut dar.)

MDN: The HTMLElement.style property returns a CSSStyleDeclaration object that represents only the element's inline style attribute.

W3C: When you set the style of an element in this manner it is the same as if you were assigning it as a declaration in a style attribute of the html element.

Bis demnächst
Matthias

--
Dieses Forum nutzt Markdown. Im Wiki erhalten Sie Hilfe bei der Formatierung Ihrer Beiträge.