body { margin:0; padding: 0; display: flex; flex-wrap: wrap; height: 930px; } .table-container{ display: flex; justify-content: center; align-items: center; border-collapse: collapse; border: 2px solid #999; } .graph-container{ flex: 1; padding: 10px; background-color: #f0f0f0; box-sizing: border-box; display: flex; flex-wrap: wrap; align-items: left; justify-content: left; } .graph{ width: 45%; height: 300px; margin: 10px; background-color: #ccc; border: 1px solid #999; } @media screen and (max-width: 1200px){ .graph{ width: 45%; } } @media screen and (max-width: 800px){ .graph{ width:90%; } 修改代码 让表格容器占页面的三分之一
时间: 2024-01-11 18:03:07 浏览: 123
rehype-wrap:用给定元素包装所选元素
可以将.table-container的flex属性改为flex: 1 0 33.33%;,这样就可以让表格容器占据页面的三分之一了。代码如下:
```
body {
margin: 0;
padding: 0;
display: flex;
flex-wrap: wrap;
height: 930px;
}
.table-container {
display: flex;
justify-content: center;
align-items: center;
border-collapse: collapse;
border: 2px solid #999;
flex: 1 0 33.33%;
}
.graph-container {
flex: 1;
padding: 10px;
background-color: #f0f0f0;
box-sizing: border-box;
display: flex;
flex-wrap: wrap;
align-items: left;
justify-content: left;
}
.graph {
width: 45%;
height: 300px;
margin: 10px;
background-color: #ccc;
border: 1px solid #999;
}
@media screen and (max-width: 1200px) {
.graph {
width: 45%;
}
}
@media screen and (max-width: 800px) {
.graph {
width: 90%;
}
}
```
阅读全文