返回介绍

附录一 CSS3 响应式布局

发布于 2024-09-07 17:46:31 字数 1774 浏览 0 评论 0 收藏 0

媒体类型

  • *all 所有媒体
  • braille 盲文触觉设备
  • embossed 盲文打印机
  • *print 手持设备
  • projection 打印预览
  • *screen 彩屏设备
  • speech ‘听觉’类似的媒体类型
  • tty 不适用像素的设备
  • tv 电视

关键字

  • and
  • not not 关键字是用来排除某种制定的媒体类型
  • only only 用来定某种特定的媒体类型

媒体特性

  • (max-width:600px)
  • (max-device-width: 480px) 设备输出宽度
  • (orientation:portrait) 竖屏
  • (orientation:landscape) 横屏
  • (-webkit-min-device-pixel-ratio: 2) 像素比
  • devicePixelRatio 设备像素比
  • window.devicePixelRatio = 物理像素 / dips

样式引入

<link rel="stylesheet" href="css/index.css" media="print" />
@import url("css/demo.css") screen;
@media screen{    }
<link rel=”stylesheet” media=”all and
 (orientation:portrait)” href=”portrait.css”>
<link rel=”stylesheet” media=”all
 and (orientation:landscape)”href=”landscape.css”>
@media screen and (min-width:360px) and (max-width:500px) {}
<link rel="stylesheet" type="text/css" 
href="indexA.css"  media="screen and (min-width: 800px)">
<link rel="stylesheet" type="text/css" 
href="indexB.css" media="screen and (min-width: 600px) and (max-width: 800px)">
<link rel="stylesheet" type="text/css" 
href="indexC.css"    media="screen and (max-width: 600px)">

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。
列表为空,暂无数据
    我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
    原文