javascript - 在表格之间切换时如何保持表格的位置不变
问题描述
第一次发帖,如有不妥请见谅...
我有两张表——一张记录我库存的木材,另一张列出将使用该木材的项目。
我设置了一个切换开关来更改显示哪个表格,但这会导致表格的位置在其垂直位置上移动。一张桌子比另一张大,所以我理解它为什么会改变……但我不确定控制这种改变的最佳方法是什么。如果可能的话,我想停止这个动作。
注意:我是 HTML/CSS/JavaScript 的新手,所以那里可能有很多乱七八糟的东西。我试图组织它,评论等。
JSFiddle:[ https://js https://jsfiddle.net/L6sdgcrq/
/*
Start table styling block
*/
.tableStats {
display: flex;
flex-direction: column;
justify-content: center;
align-items: center;
height: 500px;
}
.tableContainer {
width: 95%;
display: flex;
justify-content: center;
}
#woodTable {
width: 1200px;
max-height: 400px;
display: table;
justify-content: center;
border-radius: 15px;
border-collapse: unset;
margin-top: 15px;
margin-bottom: auto;
padding: 10px !important;
background-color: lightgray;
border-bottom: none;
}
#projectTable {
width: 1200px;
max-height: 400px;
display: none;
justify-content: center;
border-radius: 15px;
border-collapse: unset;
margin-top: 15px;
margin-bottom: auto;
padding: 10px !important;
background-color: lightgray;
border-bottom: none;
}
th {
padding: 15px;
margin: 10px;
border-bottom: 2px solid black;
border-radius: 2px;
}
td {
text-align: center;
padding: 5px;
}
tr {
padding: 10px;
}
tr:last-child, td:last-child {
border-bottom: none;
}
td:nth-child(n+1) {
border-left: 2px solid black;
}
th:first-child, td:first-child {
border-left: none;
}
.smaller {
width: 50px;
}
/*
End table styling block
*/
如果您滚动到执行部分的窗口顶部,您会看到我在说什么。
解决方案
推荐阅读
- duktape - 你可以在没有 duk_destroy_heap/duk_create_heap 的情况下将 duk_context 重置为干净的堆吗?
- tls1.2 - Apache 在 Java11+ 上嵌入 FTPS (Mina) 问题
- python - FileNotFoundError: [Errno 2] 没有这样的文件或目录(python 错误)
- docker - 默认情况下如何保护 docker 客户端连接?
- reactjs - 组件渲染后如何开始测试?
- javascript - 使用可选令牌时防止正则表达式变得贪婪?
- httpclient - 如何修复 WebAssembly 应用程序中的 HTTP PUT & DELET 错误
- node.js - 如何在快速路由中设置 nextjs 渲染?
- excel - 循环遍历单元格以查找管道 (|),其中一些已找到,但未找到其他
- django - 如何在 Django 视图中显示本地时区的 UTC 时间?