0

My media query works on Android in all browsers but not on IPhone.
I have IPhone 6s Plus and when I opened my website, it crashed the page. On other IPhones it's just css in mess. What's the problem?

@media only screen and (max-width:768px)  and  (orientation : portrait) {}
לבני מלכה
  • 15,925
  • 2
  • 23
  • 47
Alina Bayron
  • 41
  • 1
  • 7

1 Answers1

1

Just use :

@media (max-width:768px) {

}

In my opinion, the other parameters are irrelevant, they just lead you to messy stylesheets.

But keep in mind that a better approach may be to set breakpoints based on content and layout.

I advise you to read this SO Post

Sandwell
  • 1,451
  • 2
  • 16
  • 31
  • thanks for your answer but it didn't help me :( Do you know why @media could crash all browsers on IPhone? – Alina Bayron May 02 '18 at 12:34
  • Never had this issue.. Did you read this [post](https://stackoverflow.com/questions/16301910/iphone-is-ignoring-css-media-queries-viewport-tag-present-working-in-desktop) – Sandwell May 02 '18 at 12:35