CSS Media Query
【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的更多相关文章
- mobile adaptor & css media query
mobile adaptor & css media query 移动端适配 & 媒体查询 http://cssmediaqueries.com/ device-aspect-rati ...
- css Media Query详解
Media Queries详解 Media Queries直译过来就是“媒体查询”,在我们平时的Web页面中head部分常看到这样的一段代码: 1 <link href="css/re ...
- CSS media query应用中的层叠特性使用最佳实践
media query是css3规范中引入的,它提供了一种responsive design的基础机制:浏览器在不同size的设备中将以不同样式展现网页,这就给一个网页能够适应不同device一种可能 ...
- iPhone CSS media query(媒体查询)
iPhone5 iPhone6 iPhone6Plus iPad设备 media query(媒体查询)代码. iPhone < 5: @media screen and (device-a ...
- 一些实用的CSS Media Query代码片段,个人采集
CSS3的出现让响应式Web设计变得简单,CSS3提供了强大的media queries,允许你针对不同的条件设置不同的样式,可以在不修改页面内容的情况下,为不同设备提供不同的样式效果. 以下是一些C ...
- CSS media queries
最近在做一些页面打印时的特殊处理接触到了media queries,想系统学习一下,在MOZILLA DEVELOPER NETWORK看到一篇文章讲的很不错,结合自己的使用总结一下. CSS2/me ...
- 采用CSS3 Media Query技术适应Android平板屏幕分辨率和屏幕像素密度
采用HTML5在开发移动应用程序满足各种需求Android分辨率和屏幕的平板设备密度,这是非常麻烦的过程,最终的解决方案是使用css media query,匹配相同的时间分辨率和屏幕像素密度.上进行 ...
- 脚本检测 media query 分界点
当需要为不同屏幕大小添加不同脚本的时候,首先需要检测对应的media query 是否起效 也就是CSS( @screen only and (min-width: 40em) {})和javascr ...
- 响应式设计的思考:媒体查询(media query)
Jason Grigsby发表了篇文章,<CSS Media Query for Mobile is Fool’s Gold>对媒体查询(media query)吐槽,大意是在移动设备上使 ...
随机推荐
- day7--面向对象进阶(内含反射和item系列)
一面向对象的结构和成员 1.1面向对象的结构 class A: company_name = '老男孩教育' # 静态变量(静态字段) __iphone = '1353333xxxx' # 私有静态变 ...
- tkinter menu
python] view plain copy '''''Tkinter教程之Menu篇''' '''''1.创建一个简单的Menu''' # 添加菜单hello和quit,将hello菜单与hell ...
- 10.Ubuntu操作系统及python2.7、3.5 exe
Ubuntu操作系统 链接:https://pan.baidu.com/s/1cu_eYN1GnW5EwVYrXMJbEg 密码:advq python-3.5.3_32位 链接:https://pa ...
- dubbo 学习资料
入门: http://www.tuicool.com/articles/FnE3em http://www.cnblogs.com/xuyatao/p/6869231.html 最好 http://w ...
- PHP微信公共号自定义菜单。
/**微信生成菜单 * [addMennu description] */ public function addMennu(){ $token = $this->getToken(); $ur ...
- nodejs操作monggodb数据库封装
var MongoClient=require('mongodb').MongoClient; var DbUrl='mongodb://localhost:27017/productmanage'; ...
- 廖雪峰老师Python3教程练习整理
1.定义一个函数quadratic(a, b, c),接收3个参数,返回一元二次方程:ax2 + bx + c = 0的两个解 # -*- coding: utf-8 -*-import mathde ...
- java解析文件
遇到两个小坑: 1.使用String.split,部分分隔符需要转义:https://www.cnblogs.com/mingforyou/archive/2013/09/03/3299569.htm ...
- curl发送xml , xml和数组互转
public function postXml($url, array $data) { // pack xml $xml = $this->arrayToXml($data); // curl ...
- pycharm 直接删掉数据表之后,makemigration和migrate 之后,数据库中依然没有生成数据表的问题
综合分析一下行程这个问题的原因: 在终端中运行 select * from django_migrations; 查看 提交的记录,如果你的表删掉了,记录还在,那么数据库会觉得,这个表依然是存在的,所 ...