zoukankan      html  css  js  c++  java
  • 媒体查询

    响应式 Web 设计 - 媒体查询 @media

     
    响应式 Web 设计 - 媒体查询
    • @media 可以针对不同的屏幕尺寸设置不同的样式,特别是需要设置设计响应式的页面
    • 媒体类型
      • all   用于所有设备
      • print    用于打印机和打印预览
      • screen   用于电脑屏幕,平板电脑,智能手机等。
      • speech  应用于屏幕阅读器等发声设备
    •  媒体功能
      • min-width   定义输出设备中的页面最小可见区域宽度。
      • max-width   定义输出设备中的页面最大可见区域宽度。
      • device-height  定义输出设备的屏幕可见高度。
      • device-width   定义输出设备的屏幕可见宽度。
      • orientation   定义输出设备中的页面可见区域高度是否大于或等于宽度。
        • portrait (竖屏)| landscape(横屏)
        • portrait:指定输出设备中的页面可见区域高度大于或等于宽度
        • landscape: 除portrait值情况外,都是landscape
    <style>
            div {
                 100px;
                height: 100px;
                background: red;
            }
    
            /* 当页面分辨率大于768时,颜色为greenyellow,宽为800px,高为800px */
            /* @media screen and (min- 768px) {
                div {
                    background: greenyellow;
                     800px;
                    height: 800px;
                }
            } */
    
    
            /* 当页面分辨率小于768时,颜色为greenyellow,宽为800px,高为800px */
            /* @media screen and (max- 768px) {
                div {
                    background: greenyellow;
                     800px;
                    height: 800px;
                }
            } */
    
    
            /* 当页面分辨率小于768时,颜色为蓝色, 当页面分辨率在768到1200之间颜色为绿色,宽400高400,当页面分辨率大于1200时,颜色为粉色,宽为1200*/
            @media screen and (min- 768px) and (max-1200px) {
                div {
                    background: green;
                     400px;
                    height: 400px;
                }
            }
    
            @media screen and (max- 768px) {
                div {
                    background: blue;
                }
            }
    
            @media screen and (min- 1200px) {
                div {
                    background: hotpink;
                     600px;
                }
            }
        </style>
  • 相关阅读:
    PE文件捆绑实现二:(远程线程注入)
    C++中Vector清空
    ttrss更新到最新版本后发访问非80和443端口规避
    Git配置https_proxy访问github失败
    Haproxy配置拦截指定src的连接
    synology git管理程序添加
    ActiveMQ深入浅出系列 (一)
    sl4fj日志级别
    HTTP上传文件解析
    linux下jcmd无法获取jvmdump
  • 原文地址:https://www.cnblogs.com/chengxiao35/p/13546982.html
Copyright © 2011-2022 走看看