Jump to content

@media


Aucun

Recommended Posts

I'm using @media to try and get the screen resolution but I'm not sure how the statements work.

 

For example, if I want know when the viewer has a screen of 1920*1080; here is what I have so far:

@media (min-width: 1920px) { }

Is there a better way of doing this? Also, when you have many @media's how can you define an "if" type statement to check for different resolutions.

Link to comment
Share on other sites

In my limited experience you simply work your way down from widest screen to narrowest screen.

<style>/* default styles */@media screen and (min-width: 901px){/* styles necessary for largest screens */}@media screen and (min-width: 301px) and (max-width: 900px){/* changes to styles necessary for smaller screens */}@media screen and (max-width: 300px){/* changes to styles necessary for mobile screens */}</style>
Edited by davej
Link to comment
Share on other sites

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...