现在响应式设计应该是码农标配了,今天就学习学习响应式的重量级大杀器 -- media query

语法

media_query_list: [, ]*

media_query: [[only | not]? [ and ]*]

| [ and ]*

expression: ( [: ]? )

media_type: all | aural | braille | handheld | print |

projection | screen | tty | tv | embossed

media_feature: width | min-width | max-width

| height | min-height | max-height

| device-width | min-device-width | max-device-width

| device-height | min-device-height | max-device-height

| aspect-ratio | min-aspect-ratio | max-aspect-ratio

| device-aspect-ratio | min-device-aspect-ratio | max-device-aspect-ratio

| color | min-color | max-color

| color-index | min-color-index | max-color-index

| monochrome | min-monochrome | max-monochrome

| resolution | min-resolution | max-resolution

| scan | grid

蛋疼吧,原谅我~

@media meida_type and media_feature, media_type and media_feature

两种加载方式

@media (max-width: 600px) {

.facet_sidebar {

display: none;

}

}

注意:所有的media query css都会加载,只有符合条的会被解析

逻辑操作符

and 同编程语言里的and

not 同编程语言里的not

逗号

当逗号两边的条件有一个为真都为真, 同编程语言里的or

media type

all | aural | braille | handheld | print |

projection | screen | tty | tv | embossed| 3d-glasses

media feature

color

color-index

aspect-ratio

device-aspect-ratio

device-height

device-width

grid

height

monochrome

orientation : landscape | portrait

resolution

scan

width

常见设备media query

iPhones

/* ----------- iPhone 4 and 4S ----------- */

/* Portrait and Landscape */

@media only screen

and (min-device-width: 320px)

and (max-device-width: 480px)

and (-webkit-min-device-pixel-ratio: 2) {

}

/* Portrait */

@media only screen

and (min-device-width: 320px)

and (max-device-width: 480px)

and (-webkit-min-device-pixel-ratio: 2)

and (orientation: portrait) {

}

/* Landscape */

@media only screen

and (min-device-width: 320px)

and (max-device-width: 480px)

and (-webkit-min-device-pixel-ratio: 2)

and (orientation: landscape) {

}

/* ----------- iPhone 5 and 5S ----------- */

/* Portrait and Landscape */

@media only screen

and (min-device-width: 320px)

and (max-device-width: 568px)

and (-webkit-min-device-pixel-ratio: 2) {

}

/* Portrait */

@media only screen

and (min-device-width: 320px)

and (max-device-width: 568px)

and (-webkit-min-device-pixel-ratio: 2)

and (orientation: portrait) {

}

/* Landscape */

@media only screen

and (min-device-width: 320px)

and (max-device-width: 568px)

and (-webkit-min-device-pixel-ratio: 2)

and (orientation: landscape) {

}

/* ----------- iPhone 6 ----------- */

/* Portrait and Landscape */

@media only screen

and (min-device-width: 375px)

and (max-device-width: 667px)

and (-webkit-min-device-pixel-ratio: 2) {

}

/* Portrait */

@media only screen

and (min-device-width: 375px)

and (max-device-width: 667px)

and (-webkit-min-device-pixel-ratio: 2)

and (orientation: portrait) {

}

/* Landscape */

@media only screen

and (min-device-width: 375px)

and (max-device-width: 667px)

and (-webkit-min-device-pixel-ratio: 2)

and (orientation: landscape) {

}

/* ----------- iPhone 6+ ----------- */

/* Portrait and Landscape */

@media only screen

and (min-device-width: 414px)

and (max-device-width: 736px)

and (-webkit-min-device-pixel-ratio: 3) {

}

/* Portrait */

@media only screen

and (min-device-width: 414px)

and (max-device-width: 736px)

and (-webkit-min-device-pixel-ratio: 3)

and (orientation: portrait) {

}

/* Landscape */

@media only screen

and (min-device-width: 414px)

and (max-device-width: 736px)

and (-webkit-min-device-pixel-ratio: 3)

and (orientation: landscape) {

}

galaxy

/* ----------- Galaxy S3 ----------- */

/* Portrait and Landscape */

@media screen

and (device-width: 320px)

and (device-height: 640px)

and (-webkit-device-pixel-ratio: 2) {

}

/* Portrait */

@media screen

and (device-width: 320px)

and (device-height: 640px)

and (-webkit-device-pixel-ratio: 2)

and (orientation: portrait) {

}

/* Landscape */

@media screen

and (device-width: 320px)

and (device-height: 640px)

and (-webkit-device-pixel-ratio: 2)

and (orientation: landscape) {

}

/* ----------- Galaxy S4 ----------- */

/* Portrait and Landscape */

@media screen

and (device-width: 320px)

and (device-height: 640px)

and (-webkit-device-pixel-ratio: 3) {

}

/* Portrait */

@media screen

and (device-width: 320px)

and (device-height: 640px)

and (-webkit-device-pixel-ratio: 3)

and (orientation: portrait) {

}

/* Landscape */

@media screen

and (device-width: 320px)

and (device-height: 640px)

and (-webkit-device-pixel-ratio: 3)

and (orientation: landscape) {

}

/* ----------- Galaxy S5 ----------- */

/* Portrait and Landscape */

@media screen

and (device-width: 360px)

and (device-height: 640px)

and (-webkit-device-pixel-ratio: 3) {

}

/* Portrait */

@media screen

and (device-width: 360px)

and (device-height: 640px)

and (-webkit-device-pixel-ratio: 3)

and (orientation: portrait) {

}

/* Landscape */

@media screen

and (device-width: 360px)

and (device-height: 640px)

and (-webkit-device-pixel-ratio: 3)

and (orientation: landscape) {

}

htc

/* ----------- HTC One ----------- */

/* Portrait and Landscape */

@media screen

and (device-width: 360px)

and (device-height: 640px)

and (-webkit-device-pixel-ratio: 3) {

}

/* Portrait */

@media screen

and (device-width: 360px)

and (device-height: 640px)

and (-webkit-device-pixel-ratio: 3)

and (orientation: portrait) {

}

/* Landscape */

@media screen

and (device-width: 360px)

and (device-height: 640px)

and (-webkit-device-pixel-ratio: 3)

and (orientation: landscape) {

}

ipad

/* ----------- iPad mini ----------- */

/* Portrait and Landscape */

@media only screen

and (min-device-width: 768px)

and (max-device-width: 1024px)

and (-webkit-min-device-pixel-ratio: 1) {

}

/* Portrait */

@media only screen

and (min-device-width: 768px)

and (max-device-width: 1024px)

and (orientation: portrait)

and (-webkit-min-device-pixel-ratio: 1) {

}

/* Landscape */

@media only screen

and (min-device-width: 768px)

and (max-device-width: 1024px)

and (orientation: landscape)

and (-webkit-min-device-pixel-ratio: 1) {

}

/* ----------- iPad 1 and 2 ----------- */

/* Portrait and Landscape */

@media only screen

and (min-device-width: 768px)

and (max-device-width: 1024px)

and (-webkit-min-device-pixel-ratio: 1) {

}

/* Portrait */

@media only screen

and (min-device-width: 768px)

and (max-device-width: 1024px)

and (orientation: portrait)

and (-webkit-min-device-pixel-ratio: 1) {

}

/* Landscape */

@media only screen

and (min-device-width: 768px)

and (max-device-width: 1024px)

and (orientation: landscape)

and (-webkit-min-device-pixel-ratio: 1) {

}

/* ----------- iPad 3 and 4 ----------- */

/* Portrait and Landscape */

@media only screen

and (min-device-width: 768px)

and (max-device-width: 1024px)

and (-webkit-min-device-pixel-ratio: 2) {

}

/* Portrait */

@media only screen

and (min-device-width: 768px)

and (max-device-width: 1024px)

and (orientation: portrait)

and (-webkit-min-device-pixel-ratio: 2) {

}

/* Landscape */

@media only screen

and (min-device-width: 768px)

and (max-device-width: 1024px)

and (orientation: landscape)

and (-webkit-min-device-pixel-ratio: 2) {

}

nexus 平板

/* ----------- Asus Nexus 7 ----------- */

/* Portrait and Landscape */

@media screen

and (device-width: 601px)

and (device-height: 906px)

and (-webkit-min-device-pixel-ratio: 1.331)

and (-webkit-max-device-pixel-ratio: 1.332) {

}

/* Portrait */

@media screen

and (device-width: 601px)

and (device-height: 906px)

and (-webkit-min-device-pixel-ratio: 1.331)

and (-webkit-max-device-pixel-ratio: 1.332)

and (orientation: portrait) {

}

/* Landscape */

@media screen

and (device-width: 601px)

and (device-height: 906px)

and (-webkit-min-device-pixel-ratio: 1.331)

and (-webkit-max-device-pixel-ratio: 1.332)

and (orientation: landscape) {

}

kindle fire

/* ----------- Kindle Fire HD 7" ----------- */

/* Portrait and Landscape */

@media only screen

and (min-device-width: 800px)

and (max-device-width: 1280px)

and (-webkit-min-device-pixel-ratio: 1.5) {

}

/* Portrait */

@media only screen

and (min-device-width: 800px)

and (max-device-width: 1280px)

and (-webkit-min-device-pixel-ratio: 1.5)

and (orientation: portrait) {

}

/* Landscape */

@media only screen

and (min-device-width: 800px)

and (max-device-width: 1280px)

and (-webkit-min-device-pixel-ratio: 1.5)

and (orientation: landscape) {

}

/* ----------- Kindle Fire HD 8.9" ----------- */

/* Portrait and Landscape */

@media only screen

and (min-device-width: 1200px)

and (max-device-width: 1600px)

and (-webkit-min-device-pixel-ratio: 1.5) {

}

/* Portrait */

@media only screen

and (min-device-width: 1200px)

and (max-device-width: 1600px)

and (-webkit-min-device-pixel-ratio: 1.5)

and (orientation: portrait) {

}

/* Landscape */

@media only screen

and (min-device-width: 1200px)

and (max-device-width: 1600px)

and (-webkit-min-device-pixel-ratio: 1.5)

and (orientation: landscape) {

}

桌面显示器

/* ----------- Non-Retina Screens ----------- */

@media screen

and (min-device-width: 1200px)

and (max-device-width: 1600px)

and (-webkit-min-device-pixel-ratio: 1) {

}

/* ----------- Retina Screens ----------- */

@media screen

and (min-device-width: 1200px)

and (max-device-width: 1600px)

and (-webkit-min-device-pixel-ratio: 2)

and (min-resolution: 192dpi) {

}

css3 media query orientation,CSS3之media query相关推荐

  1. CSS3教程:Responsive框架常见的Media Queries片段

    CSS3 Media Queries片段 在这里主要分成三类:移动端.PC端以及一些常见的响应式框架的Media Queries片段. 移动端Media Queries片段 iPhone5 @medi ...

  2. HTML5与CSS3权威指南之CSS3学习记录

    title: HTML5与CSS3权威指南之CSS3学习记录 toc: true date: 2018-10-14 00:06:09 学习资料--<HTML5与CSS3权威指南>(第3版) ...

  3. CSS3实战开发:使用CSS3实现photoshop的过滤效果

    原文:CSS3实战开发:使用CSS3实现photoshop的过滤效果 我们知道,使用Photoshop来调整图像的亮度和对比度,或者将图片转化为灰度等等是很常见的功能.今天我将给大家介绍几个新特性,我 ...

  4. html渐变色CSS3 渐变,如何实现css3渐变色,css3渐变色怎么写

    原标题:如何实现css3渐变色,css3渐变色怎么写 CSS3 渐变(gradients)可以让你在两个或多个指定的颜色之间显示平稳的过渡. 以前,你必须使用图像来实现这些效果.但是,通过使用 CSS ...

  5. 原 CSS3中的过渡,css3之过渡

    CSS3的过渡和转换 CSS3的过渡和转换 1.过渡 什么是过渡呢?过渡通俗的来说就是从一个样式到另一个样式的逐渐转换改变的效果. 过渡的属性: 属性 描述 css transition 简写属性,用 ...

  6. CSS3盒子模型(CSS3)

    CSS3盒子模型(CSS3) <!DOCTYPE html> <html lang="en"><head><meta charset=&q ...

  7. CSS3动画序列(CSS3)

    CSS3动画序列(CSS3) <!DOCTYPE html> <html lang="en"><head><meta charset=&q ...

  8. css3动画数字变化,css3动画的更深层次的探究(矩阵变换)

    前言 其实无论哪一门技术的发展都有其根源可揪,我之前做了一些css3动画的效果,对css3流畅而又实现简单的动画效果深深着迷,遂决定探究下css3动画的来世今生, 本文如有疏漏,请各位看官及时指出,以 ...

  9. css3颜色渐变:css3如何实现背景颜色渐变?

    为了开发网页的美观,css3背景颜色渐变是经常会用到的,那么,css3背景颜色渐变如何设置呢?本篇文章我们就来介绍关于css颜色渐变背景的设置方法. 我们要知道的是css3渐变有两种类型:css3线性 ...

最新文章

  1. 马斯克终结美国载人航天的“寄俄篱下”,SpaceX首次正式商业载人任务圆满成功...
  2. 创建即时通信服务器的工具 openfire 简介
  3. 首个金融领域的开源中文预训练语言模型FinBERT了解下
  4. 30 个 OpenStack 经典面试问题和解答
  5. python实现定时发送qq消息
  6. 分布式事务中的CAP理论
  7. 16进制可逆加密算法
  8. 连不上网_手机连不上网?四种方法教你如何解决,建议收藏以备不时之需
  9. 有点火的程序秒收录牛X
  10. OpenMV(一)--基础介绍与硬件架构
  11. 亚马逊表示并未放弃WP平台:正在打造新应用
  12. 汇编中NEG和NOT的区别(汇编初学者简单笔记)
  13. SSH学习之MVC和三层架构的区别
  14. Ubuntu wine QQ卡死
  15. 适合小白的几个入门级Python ocr识别库
  16. AutoCAD 2019 for Mac 汉化安装手册
  17. WAMP5配置本地服务器(超级详细教程)
  18. Java并发学习(四)-sun.misc.Unsafe
  19. Linux虚拟主机管理系统---wdcp
  20. Python制作七夕表白实例项目-让你的情人心动起来

热门文章

  1. 人工智能芯片设计pdf_在芯片设计中引入人工智能
  2. http post请求 参数放在路径后面 java_「思唯网络学院」网络基本概念之HTTP协议...
  3. java akiba,Map集合的遍历(java)
  4. 是什么职位_为什么说,质量工程师岗位变成了 “寡妇职位”?
  5. MyEclipse中常用的快捷键
  6. 微信小程序自定义组件,提示组件
  7. 坚持不放弃,修得好结果。
  8. 从Adobe Photoshop CC 2018的“新建Web”看Web网页常见分辨率
  9. 轻松搞定个人虚拟桌面部署之1-远程桌面服务概述
  10. 2016/12/3-问鼎杯线上赛1-1-Misc