有人可以解释CSS媒体查询吗? [英] Can someone please explain CSS media queries?

查看:127
本文介绍了有人可以解释CSS媒体查询吗?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在 css3.info 上阅读了关于他们的文章,但我没有't觉得它解释得很好。我也不能得到他们的例子,改变与我的屏幕尺寸。我尝试了Safari,FF,Chrome。

I read the article about them over at css3.info, but I didn't feel like it explained it well enough. I also could not get their examples to change with my screen size. I attempted in Safari, FF, Chrome.

这是一个尚未准备好实现的功能吗?

Is this a feature that is not ready for implimentation yet?

如果我想在浏览器窗口宽度小于1024像素时调整某些样式。

If I want to adjust some styles when the browser window is less than 1024px wide. How can I do that?

推荐答案

应用于屏幕大小的规则意味着,引用W3C规范可在屏幕上使用,

The rule applied to the screen size means that, citing W3C spec "is usable on screen and handheld devices if the width of the viewport is" in the specified constraints.

http://www.w3.org/TR/css3-mediaqueries/

如果您要调整样式当视口小于1024像素时,您可以使用此规则:

If you want to adjust the style when the viewport is less than 1024px you can use this rule:

@media screen and (max-width: 1024px) { … }

此规则仅适用于视口实际大小。如果调整视口大小而不重新加载页面,则不会应用样式。

anyway this rule applies only to the viewport actual size. If you resize the viewport without reloading the page the styles won't be applied.

这篇关于有人可以解释CSS媒体查询吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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