- This topic is empty.
-
AuthorPosts
-
November 13, 2018 at 8:32 pm #278872piano0011Participant
Hey guys!
I am trying to style my media queries at the moment and not sure if I should use device width or max width? Must I also do a portrait and landscape orientation?
from,
Mervin
November 13, 2018 at 10:53 pm #278873BeverleyhParticipantshould use device width or max width?
It depends what you’re trying to do. Try making a reduced demo in CodePen and clearly explain what you’re trying to achieve, why your current attempt isn’t working as expected, and what you actually expect to happen.
Must I also do a portrait and landscape orientation?
No, you’d use whatever you need to get the job done. It depends if you’re content flows well enough vertically and/or if viewing height critically affects things in some way.
width
is typically most common in conjunction withmin-
ormax-
range features. Refer to my previous answer too though, and get more info here https://developer.mozilla.org/en-US/docs/Web/CSS/Media_Queries/Using_media_queriesNovember 19, 2018 at 8:08 pm #279156piano0011ParticipantHello!
I am trying to follow this query from one of your articles but shouldn’t the landscape with be 640px instead of 320?
/* ———– Galaxy S3 ———– */
/* Portrait and Landscape */
@media screen
and (device-width: 320px)
and (device-height: 640px)
and (-webkit-device-pixel-ratio: 2) {November 19, 2018 at 10:56 pm #279158BeverleyhParticipantNo, that’s right because of the pixel ratio.
This all sounds awfully familiar – use the answers here to guide your research in order to further your own understanding (Google is your friend) https://css-tricks.com/forums/topic/how-to-do-media-query/
Particularly;
double pixel density. Basically, a pixel isn’t a pixel anymore now that we have high def/retina screens.
Try researching
-webkit-device-pixel-ratio:2
media queriesBut, as I said before…
I wouldn’t focus on targeting specific device sizes if I were you. Rather than trying to design for specific size screens (that are changing all the time), design for your own content, and modify the layout based on your own breakpoints. Basically, pull in the browser width/height, and when the layout starts to look dodgy, change it in a media query for that size so that it looks good again.
November 19, 2018 at 11:17 pm #279159piano0011Participantthanks for the advice but according to google chrome, it says that the width is 640 when I clicked on the rotation feature?
November 19, 2018 at 11:50 pm #279161BeverleyhParticipantProbably because of that double pixel density (cycling back round to the previous answer). But hit Google for further clarification using the terms/topics suggested above.
November 20, 2018 at 10:23 pm #279302piano0011ParticipantHello!
I have seen the website that you recommended but am still a bit confused because when I clicked on the rotation button on chrome, it says that it should be 640 by 320 for landscape for a samsung s3. Also, is device-width the same as max width because when I typed device-width, it doesn’t respond well in chrome
November 20, 2018 at 11:00 pm #279303BeverleyhParticipantdouble pixel density !!!!!
is device-width the same as … width
No.
Google is your friend http://lmgtfy.com/?q=CSS+device-width
I’m going to leave this thread now because it’s too frustrating.
Good luck.
-
AuthorPosts
- The forum ‘Design’ is closed to new topics and replies.