首页技术日常照片
首页技术日常照片
© 2026 豫ICP备2024068051号-1

Grid 布局结合媒体查询@media实现动态列布局

2025.05.20·前端开发CSSGrid 布局响应式布局·
Document

        .container {
            display: grid;
            grid-template-columns: repeat(4, 1fr);
            gap: 10px;
        }

        @media screen and (max-width: 1200px) {
            .container {
                grid-template-columns: repeat(3, 1fr);
            }
        }
        @media screen and (max-width: 900px) {
           .container {
                grid-template-columns: repeat(2, 1fr);
            }
        }
        @media screen and (max-width: 600px) {
           .container {
                grid-template-columns: 1fr;
            }
        }
        .item {
            height: 100px;
            background-color: aliceblue;
        }

        1
        2
        3
        4
        5
        7
        8
        9
        10
Trea中配置mcp server:以mysql-mcp-server为例 微信小程序开发scroll-view

相关阅读

  • 全屏滚动效果实现方案
  • CSS展开收起
  • 图片布局解决方案:object-fit