Skip to content
Related Articles

Related Articles

Improve Article

HTML | <style> media Attribute

  • Last Updated : 27 Sep, 2019

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


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
  • Internet Explorer
  • Firefox
  • Apple Safari
  • Opera

Attention reader! Don’t stop learning now. Get hold of all the important HTML concepts with the Web Design for Beginners | HTML  course.

My Personal Notes arrow_drop_up
Recommended Articles
Page :