html - 浏览器外的 Flexbox
问题描述
大家好,我有一个 Flexbox,不知怎的,这个 flexbox 出现在浏览器之外(见图)。你知道为什么吗?
这 4 个容器应该留在浏览器内而不是离开它......
我想调整大小,以适应浏览器,提前非常感谢
.grid-box{
display: grid;
position: fixed;
width: 100%;
height: 100%;
grid-template-columns: 1fr 1fr 1fr 1fr;
grid-template-areas:
"box2 box2 box2 box2 "
"box2 box2 box2 box2 "
"box2 box2 box2 box2 "
"box1 box1 box1 box1 "
"box1 box1 box1 box1 ";
}
.box1 {
grid-area: box1;
background-color: #ff7443;
margin-right: 4%;
height: 100%;
}
.box2 {
grid-area: box2;
background-color: #3fc3ee;
margin-top: 10%;
float: left;
height: 100%;
width: 100%%;
}
@media screen and (min-width:736px) {
.grid-box {
display: grid;
flex: 1;
flex-basis: content;
flex-wrap: nowrap;
justify-content: space-around;
position: fixed;
width: 100%;
height: 100%;
grid-template-columns: 1fr 1fr 1fr 1fr;
grid-template-areas:
"box1 box2 box2 box2 "
"box1 box2 box2 box2 "
"box1 box2 box2 box2 "
"box1 box2 box2 box2 ";
}
.box1 {
grid-area: box1;
background-color: #ff7443;
margin-top: 30%;
margin-right: 4%;
height: 100%;
}
}
<div class="grid-box">
<div class="box1">
</div>
<div class="box2">
</div>
解决方案
推荐阅读
- python - Pybind11:使用 for 循环使用 OpenMP 访问 python 对象
- android - Android 深度链接和启动模式
- javascript - jQuery 提取令牌并将其传递给 php 位置标头
- jquery - 当 ajax 正在处理并且请求尚未完成时,如何显示另一个 DIV?
- php - 用作范围时,Laravel 查询不起作用
- elasticsearch - 为什么查询父/子关系比使用嵌套文档时更慢?
- c++ - 有谁知道为什么会这样?C++'初始化':不能从
- javascript - GeoLocation 提示不会出现在 Mobile chrome 中
- wpf - Validation.Error 在 ContentPresenter 更改内容时删除所有内容
- java - 异常:java.lang.IllegalArgumentException:切入点不是格式正确的错误?