首页 > 其他分享 >flex 一行放四div 每个div 放三个div

flex 一行放四div 每个div 放三个div

时间:2024-08-01 11:30:28浏览次数:15  
标签:flex 放四 25% padding wrap div border

<!DOCTYPE html>
<html>
<head>
<style>
  .container {
    display: flex;
    flex-wrap: wrap;
  }
  .outer-div {
    display: flex;
    width: 25%; /* 每个外部div占据100%宽度的25% */
    box-sizing: border-box;
    padding: 10px; /* 根据需要调整间距 */
  }
  .inner-div {
    flex: 1; /* 内部div平均分配宽度 */
    margin: 5px; /* 根据需要调整间距 */
    background-color: #f0f0f0; /* 背景色 */
    border: 1px solid #ccc; /* 边框 */
    padding: 10px; /* 根据需要调整内部div的内边距 */
    text-align: center; /* 文本居中 */
  }
</style>
</head>
<body>
 
<div class="container">
  <div class="outer-div">
    <div class="inner-div">1</div>
    <div class="inner-div">2</div>
    <div class="inner-div">3</div>
  </div>
  <div class="outer-div">
    <div class="inner-div">4</div>
    <div class="inner-div">5</div>
    <div class="inner-div">6</div>
  </div>
  <div class="outer-div">
    <div class="inner-div">7</div>
    <div class="inner-div">8</div>
    <div class="inner-div">9</div>
  </div>
  <div class="outer-div">
    <div class="inner-div">10</div>
    <div class="inner-div">11</div>
    <div class="inner-div">12</div>
  </div>
</div>
 
</body>
</html>

 

标签:flex,放四,25%,padding,wrap,div,border
From: https://www.cnblogs.com/lcaiqin/p/18336297

相关文章

  • flex布局之一行显示4个,如果多于4个,自动换行(只能4个 )
    <divstyle="display:flex;justify-content:space-between;flex-wrap:wrap;"><divclass="item"style="background-color:aliceblue;"></div><divclass="item"style="backgro......
  • 题解:Pinely Round 4 (Div. 1 + Div. 2) C
    C.AbsoluteZerotimelimitpertest:2secondsmemorylimitpertest:256megabytesinput:standardinputoutput:standardoutputYouaregivenanarray\(a\)of\(n\)integers.Inoneoperation,youwillperformthefollowingtwo-stepmove:Choose......
  • Codeforces Round 943 (Div. 3)A~E
    A.Maximize?题目大意:给你一个数x,你需要找到一个数y(1<=y<x),使得gcd(x,y)+y值最大,然后输出这个y思路:看范围暴力即可voidsolve(){inta,b=0,maxx=0,bj=0;cin>>a;for(inti=1;i<a;i++){b=__gcd(a,i);b+=i;if(maxx<b)......
  • Educational Codeforces Round 168 (Rated for Div. 2) (4/6)
    比赛链接:https://codeforces.com/contest/1997solve:ABCD开头:终于能上青名了,本来以为还得打个两三场,看来这暑假必须上蓝名了,不过这一场说实话感觉运气成分大一点,先稳住青名,最近感觉有点懒惰了,欠了好几场补题,牛客多校还有好多场qwq,得努力了A.StrongPassword思路:......
  • Educational Codeforces Round 168 (Rated for Div. 2) 补题记录(A~E)
    A直接暴力枚举字符添加在哪里,以及添加的字符是什么即可。#include<bits/stdc++.h>#defineintlonglongusingnamespacestd;constintN=500100;signedmain(){intT;cin>>T;while(T--){strings;cin>>s;stringans;i......
  • 题解:Pinely Round 4 (Div. 1 + Div. 2) A
    A.MaximizetheLastElementtimelimitpertest:1secondmemorylimitpertest:256megabytesinput:standardinputoutput:standardoutputYouaregivenanarray\(a\)of\(n\)integers,where\(n\)isodd.Inoneoperation,youwillremovetwoa......
  • Codeforces Round 933 (Div. 3) D 题
    D.RudolfandtheBallGame原题链接:https://codeforces.com/contest/1941/problem/D RudolfandBernarddecidedtoplayagamewiththeirfriends. n peoplestandinacircleandstartthrowingaballtoeachother.Theyarenumberedfrom 1 to nn i......
  • Codeforces Round 929 (Div. 3)---->E. Turtle vs. Rabbit Race: Optimal Trainings
    https://codeforces.com/contest/1933/problem/E#include<bits/stdc++.h>#definexfirst#defineysecondusingnamespacestd;typedeflonglongll;typedef__int128i128;typedefpair<int,int>pii;constintN=2e5+10,M=110;intn,q;inta[N];ll......
  • Codeforces Round 958 (Div. 2)A(AC)BC(补题)
    这里写目录标题A思维题【AC】B贪心(+双指针)【补题】冗余代码(我的):大佬:双指针代码借鉴后代码C异或问题【补题】A思维题【AC】思路:每次分成k-1个1,1个其他#include<iostream>#include<cstring>#include<algorithm>usingnamespacestd;//constintN=2e5+10;v......
  • Pinely Round 4 (Div. 1 + Div. 2) A - E
    A.MaximizetheLastElement答案是奇数位的最大值点击查看代码#include<bits/stdc++.h>#defineFOR(i,j,k)for(inti=(j);i<=(k);i++)#defineROF(i,j,k)for(inti=(j);i>=(k);i--)#definePIIpair<int,int>#defineintlonglong#defineULLunsi......