Media min-width max-width

0 votes

I have this @media setup:

HTML:

<head>
  <meta name="viewport" content="width=device-width, user-scalable=no" />
</head>

CSS:

@media screen and (min-width: 769px) {
    /* STYLES HERE */
}

@media screen and (min-device-width: 481px) and (max-device-width: 768px) { 
    /* STYLES HERE */
}

@media only screen and (max-device-width: 480px) {
    /* STYLES HERE */
}

It works on the iPhone but it does not work in the browser. Is this because I have a device in the meta or have max-width:480px instead?  Can someone explain to me about this?

May 7, 2022 in Others by narikkadan
• 63,600 points
902 views

No answer to this question. Be the first to respond.

Your answer

Your name to display (optional):
Privacy: Your email address will only be used for sending these notifications.
0 votes

The problem is that the older browsers cant read  @media. So when I use  @media I use it like this:

<style type="text/css">
    /* default styles here for older browsers. 
       I tend to go for a 600px - 960px width max but using percentages
    */
    @media only screen and (min-width: 960px) {
        /* styles for browsers larger than 960px; */
    }
    @media only screen and (min-width: 1440px) {
        /* styles for browsers larger than 1440px; */
    }
    @media only screen and (min-width: 2000px) {
        /* for sumo sized (mac) screens */
    }
    @media only screen and (max-device-width: 480px) {
       /* styles for mobile browsers smaller than 480px; (iPhone) */
    }
    @media only screen and (device-width: 768px) {
       /* default iPad screens */
    }
    /* different techniques for iPad screening */
    @media only screen and (min-device-width: 481px) and (max-device-width: 1024px) and (orientation:portrait) {
      /* For portrait layouts only */
    }

    @media only screen and (min-device-width: 481px) and (max-device-width: 1024px) and (orientation:landscape) {
      /* For landscape layouts only */
    }
</style>

I hope this helps in your case.

answered May 8, 2022 by Kichu
• 19,040 points

edited Mar 5

Related Questions In Others

0 votes
1 answer

How to link two min max sliders with swiftui iOS15

I see you asked it a long ...READ MORE

answered Sep 22, 2022 in Others by rajatha
• 7,680 points
1,335 views
0 votes
1 answer

Return value if scores contain value form min and Max column

So based on my comments above, here ...READ MORE

answered Mar 20, 2023 in Others by narikkadan
• 63,600 points
575 views
0 votes
1 answer

Events & Threading in Windows Forms

I don't think you should be updating ...READ MORE

answered Nov 10, 2018 in Others by nirvana
• 3,130 points
1,280 views
0 votes
1 answer

What is a name function in JavaScript & how to define it?

A named function declares a name as ...READ MORE

answered Mar 7, 2019 in Others by Frankie
• 9,830 points
4,808 views
0 votes
0 answers

Looking for Genuine & Valid Exin MOVF dumps?

Now MOVF Dumps is not much difficult ...READ MORE

Feb 9, 2021 in Others by Aaron
• 120 points
523 views
0 votes
1 answer

Media Queries: How to target desktop, tablet, and mobile?

I would personally believe that these are ...READ MORE

answered Feb 11, 2022 in Others by Soham
• 9,710 points
4,622 views
0 votes
1 answer

How to use CSS media query to scale background-image to viewing window

If you only want the desktop version ...READ MORE

answered Jun 17, 2022 in CSS by Edureka
• 12,690 points
1,447 views
0 votes
0 answers

@Media min-width & max-width

I have this @media setup: HTML: <head> <meta name="viewport" content="width=device-width, ...READ MORE

Jun 30, 2022 in CSS by Edureka
• 13,620 points
544 views
0 votes
1 answer

Make an image responsive - the simplest way

You can try doing <p> <a href="MY ...READ MORE

answered Jun 21, 2022 in CSS by Edureka
• 12,690 points
561 views
webinar REGISTER FOR FREE WEBINAR X
REGISTER NOW
webinar_success Thank you for registering Join Edureka Meetup community for 100+ Free Webinars each month JOIN MEETUP GROUP