【无标题】

此博客展示了HTML和CSS在创建响应式布局方面的应用,包括使用flexbox进行元素排列。当屏幕尺寸小于768px时,部分元素会根据媒体查询隐藏。示例中包含了不同对齐方式的演示,如顶部对齐、底部对齐、居中对齐和基线对齐。
摘要由CSDN通过智能技术生成

在这里插入图片描述
在这里插入图片描述

<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <link rel="stylesheet" href="../css/bootstrap.min.css">
    <style>
        .p-2{
            background-color: green;
            border: 1px solid black;
        }
        .f-item{
            width: 200px;
            height: 200px;
            background-color: green;
        }
        .d-flex > .f-item:nth-of-type(2){
          flex:0 1 1720px;
          background-color: white;
      }
    
      @media screen and (max-width: 768px)  {
                .item1{
                    display: none;
                }
                .item3{
                    display: none;
                }
            }


    </style>
</head>
<body>
    <div class="header" style="background-color:greenyellow; min-height: 100px; ">header</div>
    <div class="d-flex flex-row">
        <div class="f-item item1">item1</div>
        <div class="f-item item2">item2</div>
        <div class="f-item item3">item3</div>
    </div>
    <div class="footer" style="background-color:greenyellow; min-height: 50px; ">footer</div>

    <!-- <div class="d-flex flex-row">
        <div class="p-2">项目1</div>
        <div class="p-2">项目2</div>
        <div class="p-2">项目3</div>
        </div>
        <hr>
        <div class="d-flex flex-row-reverse">
            <div class="p-2">项目1</div>
            <div class="p-2">项目2</div>
            <div class="p-2">项目3</div>
            </div>
        <hr>
        <div class="d-flex flex-column">
            <div class="p-2">项目1</div>
            <div class="p-2">项目2</div>
            <div class="p-2">项目3</div>
            </div>
        <hr>
        <div class="d-flex align-items-start " style="height:100px;background-color: aquamarine;border: 1px solid black;">33333</div>
            <div class="d-flex align-items-end" style="height:100px;background-color: aquamarine;border: 1px solid black;">11111</div>
            <div class="d-flex align-items-center" style="height:100px;background-color: aquamarine;border: 1px solid black;">222222</div>
            <div class="d-flex align-items-baseline" style="height:100px;background-color: aquamarine;border: 1px solid black;">4444</div>
            <div class="d-flex align-items-stretch" style="height:100px;background-color: aquamarine;border: 1px solid black;">5555</div> -->
    <script src="../js/bootstrap.bundle.min.js"></script>
    
</body>
</html>
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值