Heim  >  Artikel  >  Web-Frontend  >  Schriftart-Tag in HTML

Schriftart-Tag in HTML

WBOY
WBOYOriginal
2024-09-04 16:27:51217Durchsuche

Font-Tag in HTML ist eines der wichtigsten Attribute, um Webseiten oder HTML-Dokumente attraktiver zu machen. Es verfügt über die Eigenschaften zum Ändern der Größe, Farbe und des Stils des enthaltenen Texts. Mit Hilfe eines Schriftart-Tags kann man die Größe, Farbe und das Gesicht einer Webseite im gleichen Textformat festlegen. Dieses Tag funktioniert hauptsächlich bei drei Hauptattributen wie Größe, Gesicht oder Typ und Farbe. Das Font-Tag fungiert als Inline-Element in HTML, um einige Funktionen von Blocktext in HTML-Dokumenten zu ändern. Der in eingeschlossene Text Tag wird verwendet, um den Stil des darin enthaltenen Textes zu definieren.

Syntax:

<font size =" " face =" " color=" ">
  • Über dem Syntaxstatus „Schriftgröße“ wird das Attribut in der Syntax verwendet, um die spezifische Größe des Textes festzulegen. Diese Größe kann in Zahlen von 1 bis 7 definiert werden, wobei 1 für den kleinsten Text und 7 für die größte Textgröße steht. Die Gesichtsattribute im Schriftart-Tag dienen zur Definition der Schriftart in unserem HTML-Dokument, während das Farbattribut zur Definition der spezifischen Farbe des eingeschlossenen Textes verwendet wird. 
  • HTML Tag, der innerhalb des Etikett. Es wird mit definiert. Tag in HTML.
<body>
<p> <font size="2" color="blue" face="Calibri"> </font>
</p>
</body>

Dieses Tag unterstützt sowohl globale als auch Ereignisattribute. Außerdem unterstützt es einige andere Attribute, die unten aufgeführt sind:

Attribute Name Detail Description
Size This attribute is used to define a specific size for text in between 1 to 7.
Face or type This attribute is used to define the font type for the included text.
Color This attribute is used to show enclosed text in a different color.
Weight This attribute defines the boldness of the text of the font tag.
Attributname

Detailbeschreibung

Größe Dieses Attribut wird verwendet, um eine bestimmte Größe für Text zwischen 1 und 7 zu definieren. Gesicht oder Typ Dieses Attribut wird verwendet, um die Schriftart für den enthaltenen Text zu definieren. Farbe Dieses Attribut wird verwendet, um eingeschlossenen Text in einer anderen Farbe anzuzeigen. Gewicht Dieses Attribut definiert die Fettschrift des Textes des Schriftart-Tags. Beispiele für Schriftart-Tags in HTML

Font-Tags können im HTML-Code auf zwei Arten verwendet werden: erstens als Include-Font-Tag und dessen Attributwert über HTML und zweitens durch die Verwendung des Attributwerts definieren als CSS-Code. Beide erzeugen die gleiche Ausgabe. Der einzige Unterschied besteht in der Definition des Attributwerts.

Beispiel #1

Schriftart-Tag mit seinem Attributwert definieren:

<!DOCTYPE html>
<html>
<head>
<title>Font Tag in HTML</title>
</head>
<body>
<h2>Example of  Font Tag in HTML </h2>
<p>General  text  without any Font tag attribute value</p>
<p>
<font color="orange">Text having normal font size and font face . Only changing
font   color  </font>
</p>
<p>
<font  face="cursive">Text having different font face.</font>
</p>
<p>
<font size="3">Text with Increased font size having default font type. </font>
</p>
</body>
</html>
Code:

Ausgabe:Schriftart-Tag in HTML

Beispiel #2

Definieren Sie das Schriftart-Tag mit seinem über CSS definierten Attributwert:

<!DOCTYPE html>
<html>
<head>
<title>Font Tag in HTML</title>
</head>
<body>
<h2>Example of Font Tag in HTML using CSS </h2>
<p>Someone’s sitting in the shade today because someone plated a tree a long time ago. </p>
<p style="color : lightgreen;"> Someone’s sitting in the shade today because someone plated a tree a long time ago.
</p>
<p style="font-family : Book Antiqua; color: blue; " > Someone’s sitting in the shade today because someone plated a tree a long time ago.
</p>
<p style="font size:3px;"> Someone’s sitting in the shade today because
someone plated a tree a long time ago.
</p>
</body>
</html>
Code:

Ausgabe:Schriftart-Tag in HTML

Beispiel #3

In diesem Beispiel verwenden wir ein Font-Tag mit dem Attributwert „Größe“, das den Text von der niedrigsten zur höchsten Größe definiert, wie unten gezeigt:

<!DOCTYPE html>
<html>
<head>
<title>HTML font tag</title>
</head>
<body>
<font size = "1">People may doubt what you say, but they will believe what you do.</font><br /> <br/>
<font size = "2">People may doubt what you say, but they will believe what you do.</font><br /> <br/>
<font size = "3">People may doubt what you say, but they will believe what you do.</font><br /> <br/>
<font size = "4">People may doubt what you say, but they will believe what you do.</font><br /> <br/>
<font size = "5">People may doubt what you say, but they will believe what you do.</font><br /> <br/>
<font size = "6">People may doubt what you say, but they will believe what you do.</font><br/><br/>
<font size = "7">People may doubt what you say, but they will believe what you do.</font>
</body>
</html>
HTML-Code:

Ausgabe:Schriftart-Tag in HTML

Beispiel #4

<!DOCTYPE html>
<html>
<head>
<title>HTML tag with Font Type attribute</title>
</head>
<body>
<font face = "Comic sans MS"> Correct one fault at a time. Concentrate on the one fault you want to overcome.</font><br/>
<font face = "Bernard MT Condensed" color="Red" >Correct one fault at a time. Concentrate on the one fault you want to overcome. </font><br/>
<font face = "Algerian">Correct one fault at a time. Concentrate on the one fault you want to overcome. </font><br/>
<font face = "Book Antiqua" size="5">Correct one fault at a time. Concentrate on the one fault you want to overcome. </font><br/>
<font face = "Aharoni"> Correct one fault at a time. Concentrate on the one fault you want to overcome.</font><br/>
<font face = "AR BERKLEY" >Correct one fault at a time. Concentrate on the one fault you want to overcome. </font><br/>
</body>
</html>
HTML-Code:

Ausgabe:Schriftart-Tag in HTML

Beispiel #5

<!DOCTYPE html>
<html>
<head>
<title>HTML Font tag-Color </title>
</head>
<body>
<font color = "#cc0066"><b>It is terrible thing to see and have no vision</b></font><br>
<font color = "#66ff33"><b>Today's preparation </b></font> <br>
<font color = "#0000cc"><strong>Success depends on your backbone not your wishbone.</strong></font><br />
<font color = "#cc3300"><b>Patience makes lighter what sorrow may not heal</b></font>  <br>
<font color = "#666600"><b>Hold fast to dreams, for if dreams die, life is broken winged bird that cannot fly </b></font> <br>
</body>
</html>
HTML-Code:

Ausgabe:Schriftart-Tag in HTML

  • Fazit
  • Es wird verwendet, um Text in derselben Größe, Farbe und demselben Gesichtsformat anzuzeigen. Das Schriftart-Tag wird mit angezeigt. Tag.
Aus all den oben genannten Informationen haben wir herausgefunden, dass Größe, Gesichtstyp und Farbe die Schlüsselattribute für den Schriftstil sind.

Das obige ist der detaillierte Inhalt vonSchriftart-Tag in HTML. Für weitere Informationen folgen Sie bitte anderen verwandten Artikeln auf der PHP chinesischen Website!

Stellungnahme:
Der Inhalt dieses Artikels wird freiwillig von Internetnutzern beigesteuert und das Urheberrecht liegt beim ursprünglichen Autor. Diese Website übernimmt keine entsprechende rechtliche Verantwortung. Wenn Sie Inhalte finden, bei denen der Verdacht eines Plagiats oder einer Rechtsverletzung besteht, wenden Sie sich bitte an admin@php.cn
Vorheriger Artikel:Canvas-Tag in HTMLNächster Artikel:Canvas-Tag in HTML