笔记、作业

笔记:

1、弹性盒子:(由弹性容器和弹性子元素组成)(flex布局)
   <style>
       .box{
          display: flex; (给最近的元素添加disply:flex)
          flex-direction: row-reverse; (flex-direction设置主轴的方向)
          flex-direction: column;
          flex-direction: column-reverse;
          flex-wrap: wrap; (允许弹性盒子的子项换行)
          justify-content: center; (水平居中)
          justify-content: flex-end;
          justify-content: space-around; (把剩余的空间平均的分配给每个元素)
          justify-content: space-between; (两边元素贴边,剩余平分)
          align-items: center; (交叉轴上元素的对齐方式)
          align-content: space-around; (控制侧轴上多行的对齐方式,和flex-warp:warp配合使用)
          width: 400px;
          height: 400px;
          background-color: aqua;
       }
       .left{
          width: 100px;
          height: 100px;
          background-color: brown;
       }
       .right{
          width: 100px;
          height: 100px;
          background-color: black;
       }
       .three{
          order: -1; (数值越小越向前)
          flex-grow: 1; (占剩余空间的几份)
          flex-shrink: 0;
          flex-basis: 200px;
          flex: 1;
          align-self: flex-start; (只改变自己的对齐方式)
       }
    </style>

2、grid布局:
   <style>
        .box{
            display: grid;
            grid-template-columns: 100px 200px 300px;
            grid-template-columns: 1fr 2fr 1fr;
            grid-template-columns: repeat(3,1fr);
            grid-template-rows: 100px 300px;
            row-gap: 20px; (行之间的间隔)
            column-gap: 20px; (列之间的间隔)
            gap: 20px;
            width: 800px;
            height: 800px;
            background-color: aliceblue;
        }
        .box1{
            grid-row: 1/3; (跨两行)
            grid-column: 1/3; (跨两列)
        }
    </style>

作业:

<!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;
        }
        .box{
            width: 1226px ;
            height: 460px;
            background-color: aliceblue;
        }
        .left{
            float: left;
            width: 234px;
            height: 460px;
            background-color:pink;
        }
        .right{
            float: right;
            width: 992px;
            height: 460px;
            background-color: rgb(1,1,1,0);
        }
        .left ul li{
            width: 234px;
            height: 46px;
            background-color:aliceblue;
            list-style: none;
            float: left;
        }
        .you{
            position: fixed;
            bottom: 180px;
            left: 0px;
            width: 41px;
            height: 69px;
            background-color: rgb(1,1,1,0.5);
        }
        .zuo{
            position: fixed;
            bottom: 180px;
            right: 0px;
            width: 41px;
            height: 69px;
            background-color: rgb(1,1,1,0.5);
        }
    </style>
</head>
<body>
    <table>
        <tr>
            <td>Xiaoml手机</td>
            <td>Redmi手机</td>
            <td>电视</td>
            <td>笔记本</td>
            <td>平板</td>
            <td>家电</td>
            <td>路由器</td>
            <td>服务中心</td>
            <td>社区</td>
        </tr>    
    </table>
    <form action="#">
        <input type="text" placeholder="加湿器">
    </form>
    <div class="box">
        <img src="./99ddbf5291c84a2aff6cfd023249ce7b.jpg" alt="">
           <div class="left">
              <ul>
                  <li>手机</li>
                  <li>电视</li>
                  <li>家电</li>
                  <li>笔记本 平板</li>
                  <li>出行 穿戴</li>
                  <li>耳机 音箱</li>
                  <li>健康 儿童</li>
                  <li>生活 箱包</li>
                  <li>智能 路由器</li>
                  <li>电源 配件</li>
              </ul>
           </div>
           <div class="right">
            <div class="you">></div>
            <div class="zuo"><</div>
           </div>   
    </div>       
</body>
</html>

  • 6
    点赞
  • 12
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值