flex布局实现等比5个盒子--logo配置组件

特点

  1. 整体使用弹性布局,整体宽度高度由空间大小决定
  2. 5个box等比展示
  3. 按钮使用固定高度,绝对底部
  4. title、img、description按内容大小自动分配空间

演示在这里插入图片描述

源码

<!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>
    <style>
      .logo-container {
        display: flex;
        gap: 8px;
      }
      .logo {
        flex: 1 1 0;
        display: flex;
        flex-direction: column;
        padding: 8px;
      }
      .logo > * {
        flex: 1 1 auto;
      }
      .logo-title {
        font-weight: bold;
        font-size: 16px;
        color: #006dcc;
      }
      .logo-img {
        max-height: 150px;
        max-width: 100%;
        align-self: center;
      }
      .logo-footer {
        flex-grow: 0;
        height: 32px;
        margin: 8px 0;
        text-align: center;
      }

      .logo-container {
        border: 2px dotted rgb(96, 139, 168);
      }
      .logo {
        border: 1px dotted rgb(96, 139, 168);
      }
    </style>
  </head>
  <body>
    <div class="logo-container">
      <div class="logo">
        <div class="logo-title">Navigation LOGO</div>
        <img
          width="100"
          class="logo-img"
          alt="logo.png"
          src="https://www.baidu.com/img/PCtm_d9c8750bed0b3c7d089fa7d55720d6cf.png"
        />
        <div>
          Image should be less than 1M,Only Support PNG Format Recommended
          width:216*56(pixels) AAA aa A A a a a a a a a a a a aa a a a a a a A
          A A A A A A A A A A A AA A A A AA A AAAA AAA A AA A AA A A A A A A A
          AAAA
        </div>
        <div class="logo-footer">
          <button type="primary" icon="qax-icon-Refresh">reupload</button>
        </div>
      </div>
      <div class="logo">
        <div class="logo-title">Navigation LOGO</div>
        <img
          class="logo-img"
          src="https://www.baidu.com/img/PCtm_d9c8750bed0b3c7d089fa7d55720d6cf.png"
        />
        <div>
          Image should be less than 1M,Only Support PNG Format Recommended
          width:216*56(pixels)
        </div>
        <div class="logo-footer">
          <button type="primary" icon="qax-icon-Refresh">reupload</button>
        </div>
      </div>
      <div class="logo">
        <div class="logo-title">Navigation LOGO</div>
        <img
          class="logo-img"
          src="https://www.baidu.com/img/PCtm_d9c8750bed0b3c7d089fa7d55720d6cf.png"
        />
        <div>
          Image should be less than 1M,Only Support PNG Format Recommended
          width:216*56(pixels)
        </div>
        <div class="logo-footer">
          <button type="primary" icon="qax-icon-Refresh">reupload</button>
        </div>
      </div>
      <div class="logo">
        <div class="logo-title">Navigation LOGO</div>
        <img
          class="logo-img"
          src="https://www.baidu.com/img/PCtm_d9c8750bed0b3c7d089fa7d55720d6cf.png"
        />
        <div>
          Image should be less than 1M,Only Support PNG Format Recommended
          width:216*56(pixels)
        </div>
        <div class="logo-footer">
          <button type="primary" icon="qax-icon-Refresh">reupload</button>
        </div>
      </div>
      <div class="logo">
        <div class="logo-title">Navigation LOGO</div>
        <img
          class="logo-img"
          src="https://www.baidu.com/img/PCtm_d9c8750bed0b3c7d089fa7d55720d6cf.png"
        />
        <div>Image</div>
        <div class="logo-footer">
          <button type="primary" icon="qax-icon-Refresh">reupload</button>
        </div>
      </div>
    </div>
  </body>
</html>

在线运行

https://code.juejin.cn/pen/7262241018488029242

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

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

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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值