html - 将css表格单元格推出浏览器窗口
问题描述
我正在研究一个布局,如果 css 表中的不同单元格的大小增加,则它们应该将彼此推出浏览器窗口。单元格的内容是通过 ajax 动态加载的。很难描述,所以我画了一个草图:
这是 css 表的初始状态:
但如果单元格 3 的宽度增加,则应该将其他单元格推到浏览器窗口之外:
我希望这可以说清楚,如果不是,我将尝试更详细地描述它。提前致谢!
解决方案
这是你想要的吗?
#parent {
background-color: khaki;
height: 200px;
margin-top: 100px;
display: flex;
flex-direction: row-reverse;
/* comment it out to remove the scrollbar */
overflow: auto;
}
#left-child {
margin: 50px 10px 0 0;
background-color: coral;
height: 100px;
order: 3;
/* change min-width to change the width of the div */
min-width: 1000px;
/* min-width: 100px; */
}
#middle-child {
margin: 50px 10px 0 0;
background-color: lightblue;
height: 100px;
order: 2;
/* change min-width to change the width of the div */
min-width: 1000px;
/* min-width: 100px; */
}
#right-child {
margin: 50px 10px 0 0;
background-color: lightgreen;
height: 100px;
order: 1;
/* change min-width to change the width of the div */
min-width: 1000px;
/* min-width: 100px; */
}
<div id="parent">
<div id="left-child"></div>
<div id="middle-child"></div>
<div id="right-child"></div>
</div>
去这个jsfiddle试试。
推荐阅读
- perl - 如何使用 shell I/O 重定向将参数传递给 Perl 脚本?
- azure - 如何通过 API 创建跨多个项目的 Azure DevOps 迭代
- reactjs - AWS Amplify:如何在一段时间不活动后使用户会话过期?
- python - Anaconda 环境中的 Spyder 版本
- scala - 在 scala 中删除和过滤数据框中的行,这些行具有除预期数据类型之外的无效数据类型内容
- jsf - 在树节点上选择后端 bean 正在获取选定的数据但不更新右面板表单数据
- prometheus - Prometheus 查询以识别指标的更改
- rust - 当长度不变时, Vec::splice() 是否有效?
- python - 如何将变量传递给字符串?神社2
- python - MongoDb 无法识别 json