Open In App
Related Articles

How to create a link with a media attribute in HTML5 ?

Improve Article
Save Article
Like Article

The <link> media Attribute attribute specifies which media/device is being optimized for the target resource. This attribute is typically used in conjunction with CSS stylesheets to specify different styles for various media types and connecting to external stylesheets, allowing the user to select the most appropriate one for the device.

This attribute accepts a variety of values. It needs a media type/media query to be its value. 


<link media="value">


  • and: It specifies an AND operator
  • not: It specifies a NOT operator
  •   ,  :  It specifies an OR operator

Example 1: The “print” value is used for print preview mode for printed pages.


<!DOCTYPE html>
    <a href="" media="print, handheld">


Whether you're preparing for your first job interview or aiming to upskill in this ever-evolving tech landscape, GeeksforGeeks Courses are your key to success. We provide top-quality content at affordable prices, all geared towards accelerating your growth in a time-bound manner. Join the millions we've already empowered, and we're here to do the same for you. Don't miss out - check it out now!

Last Updated : 26 May, 2021
Like Article
Save Article
Similar Reads
Complete Tutorials