Sample Media Query in html Header

/ Published in: CSS
Save to your folder(s)

Unlike linked style sheets, it is necessary to enclose CSS in Headers in a "style type".
This example media query is for screens under 1024 (tablets and phones) to make sure the images do not extend beyond the layout.

Copy this code and paste it in your HTML
  1. <style type="text/css">
  2. @media only screen
  3. and (max-width : 1024px) {
  4. img {
  6. max-width: 100%;
  7. }
  8. }
  9. </style>

Report this snippet


RSS Icon Subscribe to comments

You need to login to post a comment.