html - 防止从 CSS 网格流出
问题描述
当我调整浏览器的宽度以使其看起来像移动设备时,框开始从 div 流出,超过下面的一个。我将盒子的 div 设为蓝色,以便您可以清楚地看到它。
https://i.stack.imgur.com/NE92T.jpg
https://i.stack.imgur.com/irRpr.jpg
body {
background-color: #ffeead;
margin: 5%;
}
.container {
background-color: blue;
display: grid;
grid-gap: 10%;
grid-template-columns: repeat(auto-fill, 350px);
grid-auto-rows: 400px;
justify-content: center;
}
.in {
background-color: black;
display: flex;
justify-content: center;
align-items: center;
font-size: 2em;
color: #ffeead;
}
<div class="container">
<div class="in">1</div>
<div class="in">2</div>
<div class="in">3</div>
</div>
解决方案
推荐阅读
- office-js - ooxml 方法及其传递参数
- visual-studio-code - 为什么 Visual Studio Code 设置不适用
- laravel - 单元测试 Laravel 7 Passport Scope 问题在 1 个测试用例中检索错误的用户护照
- python - 如何通过 id 选择 HTML 元素,它是美丽汤中的数字
- javascript - 打字稿 axios 打字
- node.js - Mongoose/Express 多个条件搜索条件
- security - 检测到弱密码套件:服务器支持易受攻击的密码套件
- bash - 比较shell脚本中前n个字符的两个文件名
- r - 在不加载数据的情况下检查 ftp 中的文件是否存在
- swift - 将 ViewModifier 注入 SwiftUI 视图