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

Tag in HTML einbetten

WBOY
WBOYOriginal
2024-09-04 16:32:27709Durchsuche

Der Zweck des Embed-Tags in HTML besteht darin, externe Ressourcen oder Anwendungen anzuzeigen. Dies wird hauptsächlich bei Multimedia-Inhalten wie der Anzeige von Videodateien oder Audiodateien in unserer HTML-Anwendung verwendet. Dieses Tag wird auch zum Importieren von Plug-Ins wie Flash-Animatoren verwendet. Dieses Tag wird in der HTML 5-Version eingeführt. Es hat End-Tags wie

, , , usw.

Echtzeitbeispiel: Wir haben gesehen, dass so viele Websites Mediendateien in diesen Websites enthalten. Ein normales Tag wird zur Anzeige von Mediendateien nicht unterstützt. Deshalb haben wir für alle Arten von Mediendateien in HTML ein Einbettungs-Tag verwendet.

Hinweis: Dieses Tag wird auch zum Einbinden von Bildern und externen HTML-Dateien verwendet.

Wie funktioniert das Einbetten von Tags in HTML?

HTML-Einbettungsarbeit basierend auf 4 Attributen. Diese Attribute geben an, was die Einbettung tun soll.

Syntax:

<embed Required attributes>

Erforderliche Attribute: Das Tag erlaubt Attribute in jedem HTML-Dokument.

1. Höhe: Diese Attribute werden verwendet, um die Höhe des eingebetteten Inhaltselements anzugeben. Dieser Wert wird in Pixel angegeben.

Syntax:

<embed height="value in pixels">

2. width: Diese Attribute werden verwendet, um die Breite des eingebetteten Inhaltselements anzugeben. Dieser Wert wird in Pixel angegeben.

Syntax:

<embed width="value in pixels">

3. src: Wird zur Übertragung der Web-URL verwendet, d. h. zur Angabe der Webadresse des eingebetteten Inhalts.

Syntax:

<embed src="web URL">

4. Typ: Dieses Attribut wird verwendet, um den Medientyp wie Video oder Audio anzugeben.

Syntax:

<embed type="type of media">

Beispiele für das Einbetten von Tags in HTML

Hier sind die folgenden Beispiele:

Beispiel #1 – mit Bild einbetten

Code:

<!DOCTYPE html>
<html>
<title>embed attribute</title>
<head>
<!-- CSS Code -->
<style>
p {
color: red;
border: 2px solid green;
font-size: 22px;
}
h1 {
color: orange;
text-align: center;
}
</style>
</head>
<body>
<h1>The embed tag introduction</h1>
<p>
The
<embed>
tag in HTML purpose is for displaying external resources or
applications. This is used mostly in multimedia content like showing
video files or audio files into out HTML application. This embed tag
is also used for importing plug-ins like flash animators. This embed
tag is introduced in HTML 5 version. It does have ending tag as like p
tag, <html>, <body>, <a> etc.
</p>
<p>Real Time Example: We have seen so many website contains media
files within that websites. Normal tag are not supported to display
media files. So we have used embed tag for all types of media files in
HTML.</p>
<h1>The embed tag Example</h1>
<embed src="d6.jpg" width="400" height="400">
</body>
</html>

Ausgabe:

Tag in HTML einbetten

Beispiel #2 – Einbetten mit anderen HTML-Ressourcen

HTML-Code: EmbedResource.html

<!DOCTYPE html>
<html>
<title>embed attribute</title>
<body>
<!-- Embed content from other html file -->
<embed src="Resource.html" width="1000" height="200">
</body>
</html>

HTML-Code: Resource.html

<!DOCTYPE html>
<html>
<title>embed attribute</title>
<head>
<!-- CSS Code -->
<style>
p {
color: brown;
border: 2px ridge navy;
font-size: 22px;
}
h1 {
color: blue;
text-align: center;
}
</style>
</head>
<body>
<h1>The embed tag introduction</h1>
<p>
The
<embed>
tag in HTML purpose is for displaying external resources or
applications. This is used mostly in multimedia content like showing
video files or audio files into out HTML application. This embed tag
is also used for importing plug-ins like flash animators. This embed
tag is introduced in HTML 5 version. It does have ending tag as like p
tag, <html>, <body>, <a> etc.
</p>
<p>Real Time Example: We have seen so many website contains media
files within that websites. Normal tag are not supported to display
media files. So we have used embed tag for all types of media files in
HTML.</p>
</body>
</html>

Ausgabe:

Tag in HTML einbetten

Tag in HTML einbetten

Beispiel #3 – Mit der Videodatei einbetten

Code:

<!DOCTYPE html>
<html>
<title>embed attribute</title>
<head>
<!-- CSS Code -->
<style>
p {
color: brown;
border: 2px ridge navy;
font-size: 22px;
}
h1 {
color: blue;
text-align: center;
}
</style>
</head>
<body>
<h1>The embed tag introduction</h1>
<p>
The
<embed>
tag in HTML purpose is for displaying external resources or
applications. This is used mostly in multimedia content like showing
video files or audio files into out HTML application. This embed tag
is also used for importing plug-ins like flash animators. This embed
tag is introduced in HTML 5 version. It does have ending tag as like p
tag, <html>, <body>, <a> etc.
</p>
<p>Real Time Example: We have seen so many website contains media
files within that websites. Normal tag are not supported to display
media files. So we have used embed tag for all types of media files in
HTML.</p>
<!-- Embed content from other video file -->
<embed src="nationalgeography.mp4" width="400" height="300">
</body>
</html>

Ausgabe:

Tag in HTML einbetten

Tag in HTML einbetten

Fazit

In HTML einbetten wird zum Einbinden von Video- und Audiodateien in unsere HTML-Anwendung verwendet. Die Größe dieser externen Einbettungsressource kann gemäß unseren Anforderungen mithilfe von Höhen- und Breitenattributen geändert werden.

Das obige ist der detaillierte Inhalt vonTag in HTML einbetten. 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:tfoot in HTMLNächster Artikel:tfoot in HTML