How to specify media dependencies for CSS style sheets


The following are the two ways to specify media dependencies for style sheets

  • Specify the target medium from a style sheet with the @media or @import at-rules.
  • Specify the target medium within the document language.

Example

Let us see an example of @media rule −

<style>
   <!--
      @media print {
         body { font-size: 10pt }
      }

      @media screen {
         body { font-size: 12pt }
      }

      @media screen, print {
         body { line-height: 1.2 }
      }

   -->
</style>

Updated on: 16-Mar-2020

81 Views

Kickstart Your Career

Get certified by completing the course

Get Started
Advertisements