I am trying to have two columns in landscape mode or one column in portrait or landscape mode on phones.
For some reason I am getting one column on my iPad Pro when in portrait mode. Can anyone help me understand why?
Tested on the largest iPad Pro and an iPhone 12 mini, both machines in both orientations. The iPhone is correct, one column in portrait, two in landscape. The iPad is two columns in landscape (correct), but one column in portrait (incorrect).
This is my CSS:
article {
max-width: 99%;
columns: 2;
}
@media only screen
and (min-width: 375px)
and (orientation: portrait)
{
article {
columns: 1;
}
}
2
Answers
I successfully used the following, but I have not yet tested it on other devices than the iPhone 12 mini:
Perhaps someone could comment on this? I want the code to work on all smartphones, not just the iPhone 12 Mini.
You used
min-width: 375px
in the media query – everything wider will have one column.(Maybe you meant
max-width
?)