HTML5: How to specify the width of the embedded content?
Solution:
HTML Code:
<!DOCTYPE html><!-- Document type declaration for HTML5 -->
<html><!-- Start of HTML document -->
<head><!-- Start of head section -->
<meta charset="utf-8"><!-- Metadata for specifying character encoding -->
<title>How to specify the width of the embedded content</title><!-- Title of the HTML document -->
</head><!-- End of head section -->
<body><!-- Start of body section -->
<embed type="video/mp4" src="https://www.w3resource.com/w3r_videos/pop.mp4" width="300" height="300"><!-- Embedding a video with specified width and height -->
</body><!-- End of body section -->
</html><!-- End of HTML document -->
Explanation:
- The document starts with the doctype declaration specifying that it is an HTML5 document.
- Inside the <html> tags, the HTML document structure begins.
- The <head> section contains metadata about the document, including the character encoding specified using the meta tag and the title of the document.
- The <body> section is where the visible content of the webpage resides.
- The <embed> element is used to embed external content such as multimedia files (in this case, a video).
- The type attribute specifies the media type of the embedded content, which is set to "video/mp4" indicating a video file in MP4 format.
- The src attribute specifies the URL of the video file to be embedded.
- The width and height attributes specify the dimensions of the embedded content, setting the width to 300 pixels and the height to 300 pixels.
- The HTML document ends with the closing </html> tag.
Live Demo:
See the Pen embed-width-answer by w3resource (@w3resource) on CodePen.
See the solution in the browser
Supported browser
Yes | Yes | Yes | Yes | Yes |
What is the difficulty level of this exercise?
Test your Programming skills with w3resource's quiz.
- Weekly Trends and Language Statistics
- Weekly Trends and Language Statistics