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. 《机器学习实战》PCA降维

    注释:由于各方面原因,理论部分不做介绍,网上很多自行百度吧! pca.py import numpy as np import matplotlib.pyplot as plt import math ...

  2. uva-565-枚举

    16个披萨配料,选出一种组合满足所有人的需求,当然,如果某个人不喜欢A,结果里不包含A也是满足这个人的.只要答案满足题意既可,答案不唯一,special judge 用位枚举 #include < ...

  3. 重识linux-ntp时间服务器搭建

    1  安装 yum install ntp 2 启动 service ntpd start 3 配置文件 /etc/ntp.conf 4 查看是否有报错 tail /var/log/message 5 ...

  4. 21纯 CSS 创作文本滑动特效的 UI 界面

    原文地址:https://segmentfault.com/a/1190000014842868 简化版地址:https://scrimba.com/c/cgaZLh6 感想:笨蛋,想不出自己的东西. ...

  5. 1. ibatis 查询的sql列存在相同的列名

    如果SQL语句存在两个相同的查询列名,则映射时,取第一个列名的值进行映射 <?xml version="1.0" encoding="UTF-8" ?&g ...

  6. charles抓包的安装,使用说明以及常见问题解决(windows)

    charles抓包的安装,使用说明以及常见问题解决(windows) https://blog.csdn.net/zhangxiang_1102/article/details/77855548

  7. c#从基础学起string.Join(",", keys.ToArray())

    总感觉自己工作6年了,经验丰富.直到近期报了一个.net进阶班才知道.我还差得很远.就拿string.join对比 我的代码: public static int InsertModel<T&g ...

  8. 【JEECG技术文档】JEECG 接口权限开发及配置使用说明

    1.功能介绍   通过接口配置实现,对接口的访问权限控制和数据权限控制,接口时REST接口,接口权限认证机制使用Json web token (JWT) 接口权限调用流程: (1)通过接口用户的用户名 ...

  9. python语言中的数据类型之列表

    数据类型及内置方法 列表: list    可变类型,有序 用途:用来记录多个值(同属性) 定义方式:在[  ]内用逗号分隔开多个任意类型的值 l=['a','b','c'] #l=list(['a' ...

  10. 使用ab对网站进行压力测试

    1.安装yum install httpd-tools 2.ab -kc 1000 -n 1000 http://localhost/ab.html 这个指令会使用1000个并发,进行连接1000次