English | 简体中文 | 繁體中文 | Русский язык | Français | Español | Português | Deutsch | 日本語 | 한국어 | Italiano | بالعربية

HTML-Referenzhandbuch

Vollständiges Verzeichnis der HTML-Tags

HTML: <body> text-Attribut

The text attribute specifies the text color of the HTML document.

 HTML <body> Tag

Online-Beispiel

Legen Sie die Farbe des Textes in einem HTML-Dokument auf rot fest:

<!DOCTYPE html>
<html>
<head>
<title>HTML:<body> text Attribut - Grundlegende Tutorials-Website oldtoolbag.com</title>
<body text="red">
<h1>Hello world!</h1>
<p>This is some text.</p>
</body>
</html>
Testen Sie es heraus ‹/›

Browser-Verträglichkeit

IEFirefoxOperaChromeSafari

Alle gängigen Browser unterstützen das text-Attribut.

Definition und Verwendung

HTML5 wird nicht mehr unterstützt. Verwenden Sie stattdessen CSS.

Der text-Attribut von <body> im HTML 4.01is deprecated. in HTML 4.01.

The text attribute specifies the text color of the HTML document.

Compatibility Comments

In HTML 4.01 It is not recommended to use the text attribute of the body element; in XHTML 1In .0 Strict DTD, the text attribute of the body element is not supported. Please use CSS instead.

CSS Syntax (<head> section): <style>body{color:green}<//style>

CSS Example: Set Text Color in Document

In our CSS tutorial, you can find more about Text Color Attribute Knowledge.

Syntax

<body text="color_name|hex_number|rgb_number">

Attribute Value

ValueDescription
color_nameDefine the font color with color name (for example "red")。
hex_numberDefine the font color with hexadecimal value (for example "#ff0000")。
rgb_numberDefine the font color with rgb code (for example "rgb(255,0,0)")。
 HTML <body> Tag