自从升级到chrome v70.0.3538.77以来,我的域用户一直在应用CSS {column-count:2}时出现表呈现问题。
在固定高度div内滚动表格时,滚动区域保持未渲染状态(白色)。调整浏览器窗口的大小时,内容将被重绘,并且内容在滚动期间应呈现的样子。
以下小提琴演示了此问题,请确保将屏幕宽度设置为足够大,以使“一个”和“两个”表彼此相邻出现。
问题在此处得到证明:https://jsfiddle.net/L2z4srwp/1/
滚动第一个表后(注意未渲染的行位于左下方):
随后调整浏览器窗口的大小(注意重新绘制行):
以下是CSS提供的问题:
div.multiColumn {
-moz-column-count: 2;
-moz-column-gap: 1rem;
-webkit-column-count: 2;
-webkit-column-gap: 1rem;
column-count: 2;
column-gap: 1rem;
padding: 0em;
}
和HTML
<div class="multiColumn" id="divMultiColumn">
<ul class="noBullets" id="ulMultiColumn">
<li>
<h3>One</h3>
<div class="scrollingTableDiv">
<table class="teStartenTabel scrollingTable" id="id5be42585873c8">
<tr>[Lot's of rows]</tr>
</table>
</div>
<script>document.getElementById("id5be42585873c8").dataset.scrollBeyond=15;</script>
</li>
<li>
<h3>Two</h3>
<div class="scrollingTableDiv">
<table class="teStartenTabel scrollingTable" id="id5be42585873c89">
<tr><th>Datum</th><th>Blah</th><th>Blah</th><th>Blah</th><th>Blah</th><th>Blah</th><th>Blah</th><th>Blah</th><th>Blah.</th><th>Blah</th></tr>
<tr>[Lot's of rows]</tr>
</table>
</div>
<script>document.getElementById("id5be42585873c89").dataset.scrollBeyond=15;</script>
</li>
</ul>
</div>
使用javascript:
<script>
function makeTablesScroll() {
$(".scrollingTable").each(function() {
var table = this;
maxRows = parseInt(this.dataset.scrollBeyond) + 1;
var wrapper = table.parentNode;
var rowsInTable = table.rows.length;
var height = 0;
if (rowsInTable > maxRows) {
for (var i = 0; i < maxRows; i++) {
height += table.rows[i].clientHeight;
}
wrapper.style.height = height + "px";
}
});
}
</script>
任何解决方案或解决方法?我已经求助于flexbox css dev版本,但是如果左侧的表格比右侧的表格占用更多的空间,则会创建带有行和空格的栅格。列策略巧妙地平衡了两个列,并且使对象在彼此的正下方对齐,而与另一列中的对象的高度无关。
作为参考,我添加了一个Chromium错误报告:https://bugs.chromium.org/p/chromium/issues/detail?id=903287