Media Query Rule - Css

How to use css media query rule?

Snippet Code

Rate this page :
  [ 0 votes]

The @media rule is used to define various style rules for different media types and devices. You can set the desired maximum and minimum width.

<style> .demo { width: 500px; height:300px; color:yellow; background-color:red; text-align:center; } @media screen and (max-width: 420px) { .demo { width: 200px; height:100px; background-color:green; } } </style> <div align='center'> <div class='demo'>Welcome to</div> </div>


Ask Questions

Ask Question