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: Eigenschaft fgColor

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 ruft die Vordergrundfarbe oder Textfarbe des aktuellen Dokuments ab oder setzt diese.

Wert

Ein String, der die Farbe als Wort (z.B. "red") oder als hexadezimalen Wert (z.B. "#ff0000") darstellt.

Beispiele

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

Anmerkungen

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

document.fgColor ist im HTML-Standard 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