Skip to content
Related Articles
Get the best out of our app
GeeksforGeeks App
Open App

Related Articles

HTML | <style> media Attribute

Improve Article
Save Article
Like Article
Improve Article
Save Article
Like Article

The HTML style media attribute is used to specify the media or device the CSS style is optimized for. this attribute specify the style is for specific devices like print media or speech. This attribute can accept several values. 


<style media="value">

Possible Operators:

andAND operator
notNOT operator
,OR operator

and aboveDevices:

allSuitable for all devices
auralSpeech synthesizers
brailleBraille feedback devices
handheldHandheld devices (small screen, limited bandwidth)
printPrint preview mode/printed pages
screenComputer screens
ttyTeletypes and similar media using a fixed-pitch character grid
tvlow resolution or limited scroll ability type devices like Television.


widthtargeted display area’s width.
heighttargeted display area’s height
device-widthtarget display or paper’s width.
device-heighttarget display or paper’s height.
orientationtarget display or paper’s orientation.
aspect-ratiowidth/height ratio of the targeted display area.
device-aspect-ratiodevice-width/device-height ratio of the target display/paper.
colorbits per color of target display.
color-indexnumber of colors the target display can handle.
monochromebits per pixel in a monochrome frame buffer.
resolutionpixel density (dpi or dpcm) of the target display/paper.
scanscanning method of a tv display.
gridif the output device is grid or bitmap.

Note: Prefixes like “min-“ and “max-“ can be used. 



<!DOCTYPE html>
        h1 {
            color: green;
    <style media="print">
        h1 {
            color: green;
        <p><a href=""
          Click here



Supported Browsers: The browsers supported by HTML style media attribute are listed below:

  • Google Chrome 1 and above
  • Edge 12 and above
  • Internet Explorer 3 and above
  • Firefox 1 and above
  • Apple Safari 1 and above
  • Opera 3.5 and above

My Personal Notes arrow_drop_up
Last Updated : 27 Jul, 2022
Like Article
Save Article
Similar Reads
Related Tutorials