DIV CSS 佈局教程網

 DIV+CSS佈局教程網 >> 網頁腳本 >> HTML基礎知識 >> HTML5詳解 >> CSS3 Media Queries
CSS3 Media Queries
編輯:HTML5詳解     

一、Media QuerIEs 支持的屬性

屬性 值 Min/Max 描述color integer yes 每種色彩的字節數color-index integer yes 色彩表中的色彩數device-ASPect-ratio integer/integer yes 寬高比例device-height length yes 設備屏幕的輸出高度device-width length yes 設備屏幕的輸出寬度grid integer no 是否是基於格柵的設備height length yes 渲染界面的高度monoChrome integer yes 單色幀緩沖器中每像素字節resolution resolution yes 分辨率scan no tv媒體類型的掃描方式width length yes 渲染界面的寬度orIEntation Portrait/landscape no 橫屏或豎屏

height min-height max-heightdevice-width min-device-width max-device-widthdevice-height min-device-height max-device-heightaspect-ratio min-aspect-ratio max-aspect-ratiodevice-aspect-ratio min-device-aspect-ratio max-device-ASPect-ratiocolor min-color max-colorcolor-index min-color-index max-color-indexMonochrome min-monochrome max-monoChromeResolution min-resolution max-resolution

二、關鍵字

and - 結合多個媒體查詢not - 排除某種制定的媒體類型only - 用來定某種特定的媒體類型

三、引用樣式示例

<link rel="stylesheet" media="all" href="style.CSS" /><link rel="stylesheet" media="screen and (min-width:980px)" href="desktop.css" /><link rel="stylesheet" media="screen and (min-width:768px) and (max-width:980px)" href="pad.css" /><link rel="stylesheet" media="screen and (min-width:480) and (max-width: 768px)" href="phone.css" /><link rel="stylesheet" media="screen and (max-width:320px)" href="small.CSS" />

四、內聯樣式示例

@media screen and (min-width: 980px) { //CSS code}@screen and (min-width:768px) and (max-width:980px) { //css code}@screen and (min-width:480) and (max-width: 768px) { //css code}@screen and (max-width:320px) { //CSS code}@media screen and (max-device-width: 480px) { //max-device-width等於480px}@media screen and (device-aspect-ratio: 16/9), screen and (device-ASPect-ratio: 16/10) { //設備寬高比}@media all and (orientation:portrait) { //豎屏}@media all and (orIEntation:landscape) { //橫屏}

五、jQuery Media Queries Plugin for IE6/7/8

http://archive.plugins.jquery.com/project/MediaQuerIEs

六、Demo

本博客縮放即可看到效果

XML學習教程| jQuery入門知識| AJAX入門| Dreamweaver教程| Fireworks入門知識| SEO技巧| SEO優化集錦|
Copyright © DIV+CSS佈局教程網 All Rights Reserved