当前位置: 首页 > news >正文

《CSS 知识点》大屏卡片布局思路:弹性布局 flex-grow

思路

大屏左右两侧高宽一致,内部卡片可按比例设置!

  • 使用弹性布局和属性 flex-grow 设置比例;
  • 间隔使用 margin-bottom 设置,最后一个卡片不设置;

效果如图

在这里插入图片描述

代码说明

  • CSS代码 26 - 30,左右两侧设置弹性布局;
  • CSS代码 34 - 40,设置卡片直接的间隔,最后一个不设置;
  • Html代码 4 - 6,9 - 11,设置卡片比例;
<template><div class="scrollbar-main"><div class="left-cards"><div style="flex-grow: 3;"></div><div style="flex-grow: 2;" ></div><div style="flex-grow: 5;" ></div></div><div class="right-cards"><div style="flex-grow: 2;"></div><div style="flex-grow: 1;" ></div><div style="flex-grow: 1;" ></div></div></div>
</template><style lang="scss" scoped>
.scrollbar-main {position: absolute;top: 0;bottom: 0;left: 0;right: 0;.left-cards,.right-cards {position: absolute;top: 10px;bottom: 10px;display: inline-flex;flex-direction: column;width: 350px;overflow: auto;background: #ccc;>div{background: #999;margin-bottom: 10px;}>div:last-child{margin-bottom: 0;}}.left-cards {left: 10px;}.right-cards {right: 10px;}
}
</style>

flex-grow

W3school flex-grow

在这里插入图片描述

http://www.lryc.cn/news/503394.html

相关文章:

  • nVisual 登录页页面配置说明
  • 后端接受前端传递数组进行批量删除
  • 拍频实例 - 一组恒力矩电流采样数据
  • Jvm之NativeMemoryTracking 使用
  • PKCS#7、Bit padding(位填充)、Byte padding(字节填充)、Zero padding(零填充)
  • R语言学习笔记-1
  • 我在广州学 Mysql 系列之 数据“表”的基本操作
  • auto-gptq安装以及不适配软硬件环境可能出现的问题及解决方式
  • 【R语言】基础知识
  • 【一本通】虫洞
  • python爬虫--小白篇【爬虫实践】
  • Unity背包道具拖拽(极简版实现)
  • spark读取普通文件
  • MySQL SQL语句性能优化
  • 【蓝桥杯每日一题】技能升级
  • css 实现在一条线上流动小物体(offset-path)
  • 探索 Robyn 框架 —— 下一代高性能 Web 框架
  • STL容器-map P3613【深基15.例2】寄包柜 普及-
  • 【MySQL 进阶之路】了解 性能优化 与 设计原则
  • MySQL之数据库三大范式
  • [大数据]Hudi
  • jenkins harbor安装
  • JavaScript 高级特性与 ES6 新特性:正则表达式的深度探索
  • 正则表达式——参考视频B站《奇乐编程学院》
  • 【FFmpeg】FFmpeg 内存结构 ⑥ ( 搭建开发环境 | AVPacket 创建与释放代码分析 | AVPacket 内存使用注意事项 )
  • 【多模态文档智能】OCR-free感知多模态大模型技术链路及训练数据细节
  • Mybatis动态sql执行过程
  • leetcode 31 Next Permutation
  • 每日一练 | 华为 eSight 创建的缺省角色
  • PyTorch基本使用-自动微分模块