CSS -attr()- Funktion
Beispiel
Das folgende Beispiel fügt den Wert des href-Attributs in Klammern nach jedem Link ein:
a:after {
content: " (" attr(href) ")";
}
Definition und Verwendung
Die Funktion attr() gibt den Wert eines Attributs der ausgewählten Elemente zurück.
Ausführung: | CSS2 |
---|
Browser-Unterstützung
Die Zahlen in der Tabelle geben die erste Browserversion an, die die Funktion vollständig unterstützt.
Function | |||||
---|---|---|---|---|---|
attr() | 2.0 | 8.0 | 1.0 | 3.1 | 9.0 |
CSS-Syntax
attr(attribute-name)
Value | Description |
---|---|
attribute-name | Required. The name of the attribute of the HTML element(s) |