I
I
Ivan Komarov2017-09-27 17:53:48
Adaptive design
Ivan Komarov, 2017-09-27 17:53:48

Why MEDIA CSS doesn't detect phone resolution correctly?

Into this code:

@media all and (max-width: 720px) {
  .apt-short-card {
      border-top: 2px solid red !important;
  }
}

@media all and (max-width: 566px) {
.apt-short-card {
      border-top: 2px solid blue !important;
} 
}

gives expected behavior in chrome emulator
1) if resolution is 720 or less highlight top border red
2) if resolution is 566 or less highlight top border blue
But on 720px phone, I get rule #2 working.
How does it work? Thank you.

Answer the question

In order to leave comments, you need to log in

3 answer(s)
A
Aligatro, 2017-09-27
@Aligatro

First, you didn't forget to put:
And secondly - https://mydevice.io/devices/

N
Nikita, 2017-09-27
@Rema1ns

There is such a thing, in mobile phone browsers, the resolution does not match the phone screen resolution.
For example, in an iPad with a retina display, the resolution is 1024 by 768, you yourself understand that on the matrix it has 2048 × 1536

A
A person from Kazakhstan, 2017-09-27
@LenovoId

https://codepen.io/simkaUser/pen/YrZgWX?editors=1100 Everything seems to be displayed correctly...

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question