Is it possible using CSS3 media queries to ask:
‘is the height of the viewport larger than the width’?
or:
‘is the width of the viewport larger than the height’?
I would like my images to be fluid in both directions!
Thanks.
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
For this you might use the following media queries:
I cannot give you more information on the media queries, as I haven’t researched them yet. Do make sure they are supported by the devices you wish to support.
As for CSS: no, you cannot detect the width and height of your viewport using CSS. CSS is not a programming language, but a styling language. Unless you’re using a CSS preprocessor (Sass, Less), you won’t be able to do anything intelligent with it.