Dieser Inhalt wurde automatisch aus dem Englischen übersetzt, und kann Fehler enthalten. Erfahre mehr über dieses Experiment.

View in English Always switch to English

Dokument: fgColor-Eigenschaft

Deprecated

Avoid using this feature in new projects. Document color attributes are superseded by CSS. This feature may be a candidate for removal from web standards or browsers.

Consider using the following features instead: background-color, Color, CSS object model oder getComputedStyle().

fgColor liest/setzt die Vordergrundfarbe oder Textfarbe des aktuellen Dokuments.

Wert

Ein Zeichenfolgenwert, der die Farbe als Wort (z. B. "red") oder als hexadezimale Zahl (z. B. "#ff0000") darstellt.

Beispiele

js
document.fgColor = "white";
document.bgColor = "darkblue";

Hinweise

Der Standardwert für diese Eigenschaft in Mozilla Firefox ist schwarz (#000000 in Hexadezimal).

document.fgColor ist im HTML-Spezifikation veraltet. Die empfohlene Alternative ist die CSS-Eigenschaft color (z. B. document.body.style.color = "red").

Spezifikationen

Spezifikation
HTML
# dom-document-fgcolor

Browser-Kompatibilität