CSS Media Query

  CSS Media Queries are a feature in CSS3 which allows you to specify when certain CSS rules should be applied. This allows you to apply a special CSS for mobile, or adjust a layout for print.

  The basic syntax looks like this:

  

// normal style
#header-image {
background-repeat: no-repeat;
background-image:url('image.gif');
} // show a larger image when you're on a big screen
@media screen and (min-width: 1200px) {
#header-image {
background-image:url('large-image.gif');
}
} // remove header image when printing.
@media print {
#header-image {
display: none;
}
}

  But can also be called like this:

  

<link rel='stylesheet' media='all' href='normal.css' />
<link rel='stylesheet' media='print' href='print.css' />
<link rel='stylesheet' media='screen and (min-width: 701px)' href='medium.css' />

  The advantage of this method is that only the valid CSS is downloaded; so no print.css is only downloaded when printing (or using print preview).

  This example shows the 2 blocks on big screens next to each other, while on small screens they will be displayed below each other.

  

#block1, #block2 {
float: left;
width: 100%;
} @media (min-width: 1000px) {
#block1, #block2 {
width: 50%;
}
}

参考:http://cssmediaqueries.com/what-are-css-media-queries.html

CSS Media Query的更多相关文章

  1. mobile adaptor & css media query

    mobile adaptor & css media query 移动端适配 & 媒体查询 http://cssmediaqueries.com/ device-aspect-rati ...

  2. css Media Query详解

    Media Queries详解 Media Queries直译过来就是“媒体查询”,在我们平时的Web页面中head部分常看到这样的一段代码: 1 <link href="css/re ...

  3. CSS media query应用中的层叠特性使用最佳实践

    media query是css3规范中引入的,它提供了一种responsive design的基础机制:浏览器在不同size的设备中将以不同样式展现网页,这就给一个网页能够适应不同device一种可能 ...

  4. iPhone CSS media query(媒体查询)

    iPhone5  iPhone6  iPhone6Plus iPad设备 media query(媒体查询)代码. iPhone < 5: @media screen and (device-a ...

  5. 一些实用的CSS Media Query代码片段,个人采集

    CSS3的出现让响应式Web设计变得简单,CSS3提供了强大的media queries,允许你针对不同的条件设置不同的样式,可以在不修改页面内容的情况下,为不同设备提供不同的样式效果. 以下是一些C ...

  6. CSS media queries

    最近在做一些页面打印时的特殊处理接触到了media queries,想系统学习一下,在MOZILLA DEVELOPER NETWORK看到一篇文章讲的很不错,结合自己的使用总结一下. CSS2/me ...

  7. 采用CSS3 Media Query技术适应Android平板屏幕分辨率和屏幕像素密度

    采用HTML5在开发移动应用程序满足各种需求Android分辨率和屏幕的平板设备密度,这是非常麻烦的过程,最终的解决方案是使用css media query,匹配相同的时间分辨率和屏幕像素密度.上进行 ...

  8. 脚本检测 media query 分界点

    当需要为不同屏幕大小添加不同脚本的时候,首先需要检测对应的media query 是否起效 也就是CSS( @screen only and (min-width: 40em) {})和javascr ...

  9. 响应式设计的思考:媒体查询(media query)

    Jason Grigsby发表了篇文章,<CSS Media Query for Mobile is Fool’s Gold>对媒体查询(media query)吐槽,大意是在移动设备上使 ...

随机推荐

  1. mysql中的sql_mode

    mysql数据库的中有一个环境变量sql_mode,定义了mysql应该支持的sql语法,数据校验等!我们可以通过以下方式查看当前数据库使用的sql_mode: mysql> select @@ ...

  2. OraOLEDB.Oracle找不到驱动问题

    如果安装Oracle的时候没有把Oracle Provider for OLE DB,这个组件安装上,那么就会导致在使用程序的时候无法使用Oracle客户端驱动问题,弥补的办法就是重新下载客户端程序. ...

  3. xshell 设置右键粘贴

    1.打开Xshell,单击菜单栏的Tools(工具),选中Options(菜单),进入参数设置界面.. 2. 选择Keyboard and Mouse (键盘和鼠标),把Right-bottox(向右 ...

  4. spark 运行架构

    spark 运行架构基本由三部分组成,包括SparkContext(驱动程序),ClusterManager(集群资源管理器)和Executor(任务执行过程)组成. 其中SparkContext负责 ...

  5. python中的递归小实例

    #1.n! def fact(n): if n == 0: return 1 else: return n*fact(n-1)print(fact(10)) #2.斐波那契数列F(n)=F(n-1)+ ...

  6. TypeError: 'range' object doesn't support item deletion

    python 是个逐步迭代开发的过程,他不是向下兼容的,更不是向上兼容,版本不一致,好端端的程序就是不能运行了. 下面是在python 2中能运行,在Python 3中不能运行的代码.其实也很简单.但 ...

  7. python3.6.2(32位)的安装-1

    简介:Python不需要编译成机器代码,是解释执行.解释器是机器指令,CPU执行解释器,解释器执行代码. 1.Python官网下载地址:https://www.python.org/,选择Downlo ...

  8. nginx 和 php超时设置

    nginx.conf ---  http节: keepalive_timeout 600; #客户端浏览器超时时间fastcgi_connect_timeout 600; #php-fpm连接超时时间 ...

  9. mybatis初识

    mybatis采用弱连接,在一定程度上集中管理了sql的语句编写,又实现了自动映射bean. 此处以最基础的mybatis连接为例: 引入jar包: mybatis-3.4.5.jar ojdbc-6 ...

  10. ORM 的基本操作

    https://www.cnblogs.com/sss4/p/7070942.html