Advertisement
trentjs

Media Query for Height (simple)

Jan 12th, 2022
1,362
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
CSS 0.46 KB | None | 0 0
  1. <!DOCTYPE html>
  2. <html>
  3. <head>
  4. <style>
  5. body {
  6.   font-family: Arial, Helvetica, sans-serif;
  7. }
  8.  
  9. .divMedia{ /* default color if greater than 480px*/
  10.     background-color:#ff0000;
  11.     height:96vh;
  12.     width: 100%;
  13.     color: #ffffff;
  14. }
  15.  
  16. @media (max-height: 480px) {
  17.     .divMedia{ /* new color if less than 480px*/
  18.         background-color:#009900;
  19.     }
  20. }
  21.  
  22. </style>
  23. </head>
  24. <body>
  25.  
  26. <div class="divMedia">Div class .divMedia</div>
  27.  
  28. </body>
  29. </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement