inline-style lassen sich ansprechen, <style> nicht
bearbeitet von
Hallo,
wenn ich CSS Angeben eines Elements abfragen möchte, zb. so:
~~~
<style>
.xy{background-color:red;}
</style>
<h2 class="xy">
<button onclick="alert(document.querySelector('.xy').style.backgroundColor);">show test1</button>
~~~
dann kommt gar nichts, also alert() leer.
`<h2 class="xy" style="background-color:orange;">`
so aber schon. Warum?
[Beispiel.](https://www.w3schools.com/code/tryit.asp?filename=GOQ0ZFTSAHJP)
Gruss
Henry
--
Meine Meinung zu DSGVO & Co:
„Principiis obsta. Sero medicina parata, cum mala per longas convaluere moras.“