How to specify media dependencies for CSS style sheets

CSSWeb DevelopmentFront End Technology

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>
raja
Published on 27-Apr-2018 08:09:24
Advertisements