css3 flex弹性盒子布局简单使用

复制代码
<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <link rel="stylesheet" href="./csses/mycss.css">
</head>

<body>
    <!-- <div class="mydiv">wwwwqqq</div> -->
    <div class="flexcontent">
        <div class="flexitem">1justify-content: center</div>
        <div class="flexitem">2justify-content: center</div>
        <div class="flexitem">3justify-content: center</div>
        <div class="flexitem">4justify-content: center</div>
    </div>
    <div class="flexcontent2">
        <div class="flexitem2">1justify-content: space-between</div>
        <div class="flexitem2">2justify-content: space-between</div>
        <div class="flexitem2">3justify-content: space-between</div>
        <div class="flexitem2">4justify-content: space-between</div>
    </div>
    <div class="flexcontent3">
        <div class="flexitem3">1justify-content: space-around</div>
        <div class="flexitem3">2justify-content: space-around</div>
        <div class="flexitem3">3justify-content: space-around</div>
        <div class="flexitem3">4justify-content: space-around</div>
    </div>
    <div class="flexcontent4">
        <div class="flexitem4">1justify-content: space-evenly</div>
        <div class="flexitem4">2justify-content: space-evenly</div>
        <div class="flexitem4">3justify-content: space-evenly</div>
        <div class="flexitem4">4justify-content: space-evenly</div>
    </div>
</body>

</html>
复制代码
复制代码
.flexcontent{
    margin-top: 10px;
    display: flex;
    width: 1000px;
    height: 120px;
    border: 1px solid rebeccapurple;
    justify-content: center;
    /* direction: rtl; */
    /* direction:ltr; rtl; 排列開始從左到右還是從右到左側*/
}
.flexcontent2{
    margin-top: 10px;
    display: flex;
    width: 1000px;
    height: 120px;
    border: 1px solid rgb(44, 143, 46);
    justify-content:space-between
   
}
.flexcontent3{
    margin-top: 10px;
    display: flex;
    width: 1000px;
    height: 120px;
    border: 1px solid rgb(143, 84, 44);
    justify-content:space-around
  
}
.flexcontent4{
    margin-top: 10px;
    display: flex;
    width: 1000px;
    height: 120px;
    border: 1px solid rgb(75, 44, 143);
    justify-content:space-evenly
}
.flexitem{
    width: 120px;
    height: 80px;
    border: 1px solid rgb(127, 153, 51);
    margin: 10px;
    background-color: bisque;
    text-align: center;
}
.flexitem2{
    width: 120px;
    height: 80px;
    border: 1px solid rgb(127, 153, 51);
    margin: 10px;
    background-color: rgb(167, 165, 162);
    text-align: center;
}
.flexitem3{
    width: 120px;
    height: 80px;
    border: 1px solid rgb(127, 153, 51);
    margin: 10px;
    background-color: rgb(121, 139, 120);
    text-align: center;
}
.flexitem4{
    width: 120px;
    height: 80px;
    border: 1px solid rgb(127, 153, 51);
    margin: 10px;
    background-color: rgb(102, 189, 150);
    text-align: center;
}
复制代码

 

posted @   天天向上518  阅读(2)  评论(0编辑  收藏  举报
相关博文:
阅读排行:
· 阿里最新开源QwQ-32B,效果媲美deepseek-r1满血版,部署成本又又又降低了!
· Manus重磅发布:全球首款通用AI代理技术深度解析与实战指南
· 开源Multi-agent AI智能体框架aevatar.ai,欢迎大家贡献代码
· 被坑几百块钱后,我竟然真的恢复了删除的微信聊天记录!
· AI技术革命,工作效率10个最佳AI工具
历史上的今天:
2019-11-01 封装自己通用的 增删改查的方法 By EF
2019-11-01 怎么在.Net Core3.0/ 3.1Webapi 中使用Log4net 写日志 及读取配置文件的信息
点击右上角即可分享
微信分享提示