媒体查询 - 视口大于宽度的高度? [英] Media Query - is height of viewport larger than width?

查看:473
本文介绍了媒体查询 - 视口大于宽度的高度?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

是否可以使用CSS3媒体查询询问:



'是视口的高度大于宽度'?



或:



'是视口的宽度大于高度'?



解决方案

div>

为此,您可以使用以下媒体查询:

  orientation:portrait 
orientation:landscape

我不能给你更多的媒体查询信息,因为我还没有研究他们。请确保您要支持的设备支持它们。



对于CSS:否,您无法使用CSS检测视口的宽度和高度。 CSS不是一种编程语言,而是一种造型语言。除非你使用CSS预处理器(Sass,Less),否则你将无法使用它做任何聪明的事情。


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.

解决方案

For this you might use the following media queries:

orientation:portrait
orientation:landscape

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.

这篇关于媒体查询 - 视口大于宽度的高度?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆