A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from https://www.w3resource.com/html-css-exercise/basic/a_media-answer.php below:

Website Navigation


HTML5: Create a link with a media attribute?

HTML5: Create a link with a media attribute?Last update on December 22 2023 12:18:00 (UTC/GMT +8 hours)

Go To Hyperlink page

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 to "Create a link with a media attribute" -->
<title>Create a link with a media attribute</title>

<!-- Close the head section -->
</head>

<!-- Start the body section containing the content of the document -->
<body>

<!-- Create a hyperlink with a specified URL and media attribute -->
<a href="https://www.w3resource.com" media="print, handheld">Media Attribute</a>

<!-- 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 hyperlink. The special addition here is the use of the 'media' attribute within the hyperlink. This specifies that the linked resource is designed for "print" and "handheld" media types.

Here's a brief explanation of each part of HTML code:

Live Demo:

See the Pen a_media-answer by w3resource (@w3resource) on CodePen.

View the example in the browser

Supported browser

Go To Hyperlink page

What is the difficulty level of this exercise?

Test your Programming skills with w3resource's quiz.




RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4