我需要一些帮助来在执行可排序或拖动移动时保持 CSS 样式(td 宽度等)。
到目前为止我的代码:
CSS:
body {
margin: 30px;
}
table {
border-collapse: separate;
border-spacing: 0;
min-width: 350px;
}
table tr th,
table tr td {
border-right: 1px solid #bbb;
border-bottom: 1px solid #bbb;
padding: 5px;
}
table tr th:first-child,
table tr td:first-child {
border-left: 1px solid #bbb;
}
table tr th {
background: #eee;
border-top: 1px solid #bbb;
text-align: left;
}
/* top-left border-radius */
table tr:first-child th:first-child {
border-top-left-radius: 6px;
}
/* top-right border-radius */
table tr:first-child th:last-child {
border-top-right-radius: 6px;
}
/* bottom-left border-radius */
table tr:last-child td:first-child {
border-bottom-left-radius: 6px;
}
/* bottom-right border-radius */
table tr:last-child td:last-child {
border-bottom-right-radius: 6px;
}
当我开始拖动表 1 上的一行时,该行失去了上边框。我该如何解决这个问题?
最佳答案
你也应该指定 border-top: 1px solid #bbb;
,你只指定了 border-bottom
和 border-right
只有
所以解决方法是
table tr th,
table tr td {
border-right: 1px solid #bbb;
border-bottom: 1px solid #bbb;
border-top: 1px solid #bbb;
padding: 5px;
}
关于jQuery 可排序和可拖动表格在拖动时保持 CSS 样式,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/25270296/