HTML5: How to specify the size of the linked resource?
Solution:
HTML Code:
<!DOCTYPE html><!-- Declares the document type and version of HTML -->
<html><!-- Begins the HTML document -->
<head><!-- Contains metadata about the document -->
<meta charset="utf-8"><!-- Specifies the character encoding for the document -->
<link rel="icon" href="//www.w3resource.com/images/favicon.png" type="image/png" sizes="16x16"><!-- Specifies the favicon for the website and its size -->
<title>How to specify the size of the linked resource</title><!-- Sets the title of the document -->
</head><!-- Ends the head section -->
<body><!-- Contains the content of the document -->
<h2>Tutorial</h2><!-- Displays a heading -->
<p>Open this page in a <a href="http://localhost/html-css-exercise/basic/solution/exercise-link-size-tag-answer.html" target="_blank">new window</a> to see the favicon.</p><!-- Provides a link to open the page in a new window -->
</body><!-- Ends the body section -->
</html><!-- Ends the HTML document -->
Explanation:
- The HTML document begins with a declaration of its type and version (<!DOCTYPE html>).
- The <html> element encloses the entire HTML document.
- The <head> section contains metadata about the document, including the character encoding, favicon link, and title.
- Inside the <head> section, the <link> element specifies the favicon for the website (rel="icon") with the URL "//www.w3resource.com/images/favicon.png". It also specifies the type of the linked resource (type="image/png") and its size (sizes="16x16").
- The <body> section contains the content of the document.
- It includes a heading (<h2>) and a paragraph (<p>) with a hyperlink (<a>) that opens the linked page in a new window (target="_blank").
- The linked page is specified by the href attribute of the <a> element.
Live Demo:
See the Pen exercise-link-size-tag-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.
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://w3resource.com/html-css-exercise/basic/exercise-link-size-tag-answer.php
- Weekly Trends and Language Statistics
- Weekly Trends and Language Statistics