Kann jemand bitte erklären, was ist das Schlüsselwort erben in CSS?Was bewirkt das Schlüsselwort in CSS?
19
A
Antwort
30
Es wird den gleichen Wert wie die gleiche Eigenschaft nutzen, um seine Eltern haben .
html:
<body>
<h1></h1>
</body>
css:
body{
margin: 234px;
}
h1{
margin: inherit; #=234px
}
Hinweis darauf, ob es mehrere Instanzen von <h1>
in der Datei, wird die Marge nehmen es Eltern. 234px ist also nicht immer der Wert, den es haben wird. Zum Beispiel
html:
<body>
<h2></h2>
<div>
<h2></h2>
</div>
</body>
css:
body{
margin: 20px;
}
div{
margin: 30px;
}
h2{
margin: inherit; #20px if parent is body; 30px if parent is div
}
7
Ich werde nicht auf sitepoint.com die feine Erklärung plagiieren so dass ich nur die URL hier geben würde:
+0
Der Sitepoint Artikel ist super klar mit großer Erklärung! Gute Verbindung! –
Verwandte Themen
- 1. Was bewirkt das Schlüsselwort 'in' in F #?
- 2. Was bewirkt das Call-Schlüsselwort in VB6?
- 3. Was bewirkt das Schlüsselwort "where" in einer Klassendeklaration?
- 4. Was bewirkt "Zoom" in CSS?
- 5. Was bewirkt das COLLATE-Schlüsselwort beim Erstellen eines SQLite-Indexes?
- 6. Was bewirkt setWidth ("*") in CSS/SmartGWT?
- 7. Was bewirkt das Rückgabe-Schlüsselwort in einer void-Methode in Java?
- 8. Was bewirkt das exportierte Attribut in .classpath?
- 9. Was bewirkt das Aux-Muster in Scala?
- 10. Was ist das Schlüsselwort Rust?
- 11. Was bedeutet das Schlüsselwort KEY?
- 12. Was bedeutet das Schlüsselwort jsr?
- 13. Was bedeutet das externe Schlüsselwort?
- 14. Was bedeutet das Schlüsselwort "final"?
- 15. Was ist das "as" Schlüsselwort in swift
- 16. Was nutzt das Schlüsselwort "far" in Delphi?
- 17. Was macht das virtuelle Schlüsselwort in ActionScript?
- 18. Was ist das `name` Schlüsselwort in JavaScript?
- 19. Was ist das Schlüsselwort "THE" in Oracle?
- 20. Was bedeutet das Schlüsselwort "set" in Ruby?
- 21. Was ist das `finally` Schlüsselwort in PHP?
- 22. Was bewirkt das construct-Schlüsselwort, wenn es zu einer Methode hinzugefügt wird?
- 23. Openstack Port Quota, was bewirkt das?
- 24. Was bewirkt, dass das FederatedAuthentication.SessionAuthenticationModule NULL zurückgibt?
- 25. Was bewirkt das Hinzufügen eines GLuint-Attributindex?
- 26. Was bewirkt das -all_load-Linker-Flag?
- 27. Was bewirkt das Namensattribut des fieldset-Elements?
- 28. Was bewirkt das @ vor einem Parameternamen?
- 29. Was bewirkt das HTML Bindpoint Attribut?
- 30. Was bewirkt `session.entropy_length` in` PHP.ini`?
Es ist wichtig, dies zu beachten, funktioniert nicht in IE6 + IE7, aber gute Antwort. +1 –
Auch in IE8- es funktioniert mit "Richtung" und "Sichtbarkeit" Eigenschaften –
Ich denke, die Person, die diese Frage gestellt hat, wusste, wie "erben" funktioniert, was er [wahrscheinlich] wissen wollte, aber: "Was ist der Nutzen Fälle für die Verwendung von CSS erben Mechanismus " –