CSS(响应式布局) 笔记 14

 @media [not|only] 设备名称and设备特性{}

1. 设备类型:

       ①screen 计算机屏幕

       ② tv 电视

       ③projection 投影仪

       ④ all 全部设备

 2. 设备特性:

        ①width 设备宽度

        ②min-width 最小宽度

        ③max-width 最大宽度

        ④height 设备高度

        ⑤resolution 分辨率

        ⑥aspect-ratio 设备宽高比

3.e.g

<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <style>
            *{
                margin: 0;
                padding: 0;
            }
        
            .c{
                width:750px;
                margin: 50px auto;
                background: aquamarine;
            }
            .c div{
                border:4px solid rgb(225, 58, 114);
                margin: 10px;
                border-radius: 20px;
                
            }

            .c .t1{
                float: left;
                width: 385px;
                height: 300px;
            }
            .c .t2{
                float: left;
                width: 300px;
                height: 300px;
            }
            .c .t3{
                float: left;
                width: 750px;
                height: 300px;
            }
        
            @media screen and (max-width:1000px){
                /* 在宽度<1000px的区间内,执行以下样式 */
                .c{
                width:150px;
                margin: 50px auto;
                background: aquamarine;
            }
            .c div{
                border:4px solid rgb(225, 58, 114);
                margin: 10px;
                border-radius: 100px;
                
            }

            .c .t1{
                float: left;
                width: 150px;
                height: 100px;
            }
            .c .t2{
                float: left;
                width: 150px;
                height: 250px;
            }
            .c .t3{
                float: left;
                width: 150px;
                height: 250px;
            }
            }
 
    </style>
</head>
<body>
   <div class="c">
    <div class="t1">
        <h1>one</h1>

    </div>
    <div class="t2">
        <h1>two</h1>

    </div>
    <div class="t3">
        <h1>three</h1>

    </div>
   </div>


</body>
</html>

  • 6
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值