HTML5: What shall be the correct value of the media attribute of a hyperlink which points to an HTML document?
Solution :
HTML Code :
<!-- Declare the document type as HTML5 -->
<!DOCTYPE html>
<!-- Start the HTML document -->
<html>
<!-- Start the head section containing metadata about the document -->
<head>
<!-- Set the character encoding to UTF-8 -->
<meta charset="utf-8">
<!-- Set the title of the document -->
<title>What shall be the correct value of the media attribute of a hyperlink which points to an HTML document</title>
<!-- Close the head section -->
</head>
<!-- Start the body section containing the content of the document -->
<body>
<!-- Create a paragraph with a hyperlink -->
<p><a href="https://www.w3resource.com" media="screen">w3resource Exercises</a></p>
<!-- Close the body section -->
</body>
<!-- Close the HTML document -->
</html>
Explanation:
The above HTML code defines a basic HTML5 document with metadata in the head section and a body containing a paragraph with a hyperlink. The media="screen" attribute in the hyperlink specifies that the linked resource is intended for display on a computer screen.
Here's a brief explanation of each part of HTML code:
- <!DOCTYPE html>: Declares the document type as HTML5.
- <html>: Marks the beginning of the HTML document.
- <head>: Contains metadata about the document, such as character encoding and the title.
- <meta charset="utf-8">: Sets the character encoding to UTF-8.
- <title>What shall be the correct value of the media attribute of a hyperlink which points to an HTML document</title>: Sets the title of the HTML document.
- </head>: Closes the head section.
- <body>: Contains the actual content of the HTML document.
- <p><a href="https://www.w3resource.com" media="screen">w3resource Exercises</a></p>: Creates a paragraph with a hyperlink. The href attribute specifies the URL ("https://www.w3resource.com"), and the media="screen" attribute indicates that the linked resource is designed for display on a computer screen.
- </body>: Closes the body section.
- </html>: Marks the end of the HTML document.
Live Demo:
See the Pen a_type-answer by w3resource (@w3resource) on CodePen.
View the example 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.
It will be nice if you may share this link in any developer community or anywhere else, from where other developers may find this content. Thanks.
https://www.w3resource.com/html-css-exercise/basic/a_type-answer.php
- Weekly Trends and Language Statistics
- Weekly Trends and Language Statistics