刷新 HTML 出现故障
Flush HTML out of order
是否可以乱序刷新 html 并让浏览器按顺序显示内容?我知道我可以在客户端利用 JS,但是否可以仅使用 CSS?
例如,如果我的 html 最终按以下顺序被刷新:
<html><body>
<div>3</div>
<div>1</div>
<div>4</div>
<div>2</div>
</body></html>
是否有任何 CSS 我可以准备好,所以页面上显示的 html 是:
1
2
3
4
没有。你只需要使用 JS 或任何其他编程语言来执行此操作,因为 CSS 用于 styling/haptic 而 HTML 用于结构。
您可以使用表格作为可能的解决方案:http://jsfiddle.net/UJWP4/37/
<div class="wrapper">
<div class="bottom">
<div class="block">3</div>
</div>
<div class="top">
<div class="block">1</div>
</div>
<div class="middle">
<div class="block">2</div>
</div>
</div>
.wrapper {
display: table;
width: 100%;
}
.top {
display: table-header-group;
}
.bottom {
display: table-footer-group;
}
.middle{
display:table-row-group;
}
但是,这可能仅限于 3 个部分,除非您可以 fiddle 并获得更多申请。除此之外,我认为 js 是可行的方法
希望对您有所帮助!
是否可以乱序刷新 html 并让浏览器按顺序显示内容?我知道我可以在客户端利用 JS,但是否可以仅使用 CSS?
例如,如果我的 html 最终按以下顺序被刷新:
<html><body>
<div>3</div>
<div>1</div>
<div>4</div>
<div>2</div>
</body></html>
是否有任何 CSS 我可以准备好,所以页面上显示的 html 是:
1
2
3
4
没有。你只需要使用 JS 或任何其他编程语言来执行此操作,因为 CSS 用于 styling/haptic 而 HTML 用于结构。
您可以使用表格作为可能的解决方案:http://jsfiddle.net/UJWP4/37/
<div class="wrapper">
<div class="bottom">
<div class="block">3</div>
</div>
<div class="top">
<div class="block">1</div>
</div>
<div class="middle">
<div class="block">2</div>
</div>
</div>
.wrapper {
display: table;
width: 100%;
}
.top {
display: table-header-group;
}
.bottom {
display: table-footer-group;
}
.middle{
display:table-row-group;
}
但是,这可能仅限于 3 个部分,除非您可以 fiddle 并获得更多申请。除此之外,我认为 js 是可行的方法
希望对您有所帮助!