<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Media Embedding Example</title>
<style>
img, video, audio {
max-width: 100%;
height: auto;
}
</style>
</head>
<body>
<h1>Embedding Media in HTML</h1>
<h2>Embedded Image</h2>
<img src="path/to/image.jpg" alt="Description of the image">
<h2>Embedded Video</h2>
<video controls>
<source src="path/to/movie.mp4" type="video/mp4">
<source src="path/to/movie.ogg" type="video/ogg">
Your browser does not support the video tag.
</video>
<h2>Embedded Audio</h2>
<audio controls>
<source src="path/to/audio.mp3" type="audio/mpeg">
<source src="path/to/audio.ogg" type="audio/ogg">
Your browser does not support the audio element.
</audio>
</body>
</html>
Explanation of code:
HTML Structure: The code begins with a <html> element that declares English as the language and the typical <!DOCTYPE html> declaration. It has a title, viewport settings for responsiveness, a <style> element for CSS rules, and a <head> section with character encoding.
CSS Rules: Within the <style> tag, CSS makes sure that photos, videos, and music all scale proportionately with the width of the device, keeping their aspect ratios within reason and never going wider than the screen.
Media Elements:
This code offers a thorough illustration of how to incorporate and handle media into a webpage, guaranteeing that it is adaptable and viewable on various platforms and web browsers.
<!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8"> <meta name="viewport" content="width=device-width, initial-scale=1.0"> <title>Media Embedding Example</title> <style> img, video, audio { max-width: 100%; height: auto; } </style> </head> <body> <h1>Embedding Media in HTML</h1> <h2>Embedded Image</h2> <img src="path/to/image.jpg" alt="Description of the image"> <h2>Embedded Video</h2> <video controls> <source src="path/to/movie.mp4" type="video/mp4"> <source src="path/to/movie.ogg" type="video/ogg"> Your browser does not support the video tag. </video> <h2>Embedded Audio</h2> <audio controls> <source src="path/to/audio.mp3" type="audio/mpeg"> <source src="path/to/audio.ogg" type="audio/ogg"> Your browser does not support the audio element. </audio> </body> </html> |
Explanation of code:
HTML Structure: The code begins with a <html> element that declares English as the language and the typical <!DOCTYPE html> declaration. It has a title, viewport settings for responsiveness, a <style> element for CSS rules, and a <head> section with character encoding.
CSS Rules: Within the <style> tag, CSS makes sure that photos, videos, and music all scale proportionately with the width of the device, keeping their aspect ratios within reason and never going wider than the screen.
Media Elements:
This code offers a thorough illustration of how to incorporate and handle media into a webpage, guaranteeing that it is adaptable and viewable on various platforms and web browsers.
Copyrights © 2024 letsupdateskills All rights reserved