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

flex加 grid 布局笔记

<style>
    .flex-container {
        display: flex;
        height: 100%; /* 设置容器的高度 */
    }
    .wide {
        display: flex;
        padding: 10px;
        border: 1px solid lightgray;
        text-align: center;
        justify-content: center; /* 在水平方向上居中 */
        align-items: center; /* 在垂直方向上居中 */
        width: 50%;
    }
    .grid-container {
        display: grid;
        grid-template-columns: repeat(2, 1fr); /* 创建两列 */
        grid-template-rows: repeat(2, 1fr); /* 创建两行 */
        gap: 50px; /* 设置列和行之间的间距 */
    }

    .grid-item {
        width: 140px;
        height: 140px;
        background-color: white;
        padding: 20px;
        text-align: center;
        display: grid;
        border: 1px solid #4974A4;
        place-items: center;
       
    }
        .active {
            background-color: #4974A4;
            color: #fff;
        }
    .grid-item {
        transition: background-color 0.3s ease;
    }
        .grid-item:hover:hover {
            background-color: #4974A4;
            color: #fff;
        }
       
        /*.grid-item img {
            width: 140px;
            height: 100px;
        }*/
    .container {
        display: flex;
        flex-direction: column; /* 竖向排列 */
        align-items: center; /* 居中对齐 */
        height: 300px; /* 设置容器高度 */
        border: 1px solid #ccc; /* 边框用于可视化 */
    }

    .item {
        width: 300px;
        height: 50px;
        margin: 50px;
        text-align: center;
        line-height: 50px;
        border: 1px solid #4974A4;
        color: black;
    }
        .item:hover {
            background-color: #4974A4;
            color: #fff;
        }

//灰色线
     .gray-hr {
            border: none;
            border-top: 1px solid #ccc; /* 灰色边框线 */
            margin: 10px 0; /* 可以调整线的上下间距 */
        }
</style>
<div class="flex-container">
    <div class="wide">
        <div class="grid-container" id="typeContainer">
            
                        <div class="grid-item" οnclick="typeClick(@ele.Code)" id="type_@ele.Code">

                           
                                <img src="@ele.STRING_1"  />
                                <span style=" font-size: 16px; font-weight:bold">@ele.TextValue</span>
                           

                        </div>
                    }
                    }
                }


            </div>
    </div>
    <div class="wide"  id="typeChildContainer" style="display: none; flex-direction: column"><div  id="containers"></div>
                                                                    </div>
</div>

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

相关文章:

  • 最高评级!华为云CodeArts Board获信通院软件研发效能度量平台先进级认证
  • 图像上传功能实现
  • 03_Node.js模块化开发
  • Nginx支持SNI证书,已经ssl_server_name的使用
  • Hive【Hive(六)窗口函数】
  • Met no ‘TRANSLATIONS’ entry in project
  • Leetcode901-股票价格跨度
  • “传统文化宣传片+虚拟人动捕设备”前景如何?
  • 节假日moc服务数据:解决用户99%的IT问题
  • WOL唤醒配置(以太网、PHY、MAC)
  • MySQL复制,约束条件,查询与安全控制
  • Java ES 滚动查询
  • 机器学习算法基础--KNN算法分类
  • 深入探究 C++ 编程中的资源泄漏问题
  • BLE协议栈1-物理层PHY
  • 光伏储能直流系统MATLAB仿真(PV光伏阵列+Boost DCDC变换器+负载+双向DCDC变换器+锂离子电池系统)
  • C++三大特性——继承(上篇)
  • docker系列(9) - docker-compose
  • Vue中如何进行日历展示与操作
  • SpringBoot 返回图片、Excel、音视频等流数据几种处理方式
  • 【Vue面试题一】、说说你对 Vue 的理解
  • vue3 axios
  • 划片机:半导体生产的必备设备
  • 电路维修——双端队列BFS
  • 乌班图22.04 kubeadm简单搭建k8s集群
  • vue3富文本编辑器的二次封装开发-Tinymce
  • typescript 类型声明文件
  • Hadoop伪分布式环境搭建
  • javaee ssm框架项目添加分页控件
  • 2023年中国非晶纳米晶竞争格局、产业链及行业产量分析[图]