如何用JavaScript填充列?
使用columnFill属性填充列。将其填充为自动以顺序填充,或平衡以在列之间平均分配内容。
示例
您可以尝试运行以下代码以使用JavaScript设置填充列-
<!DOCTYPE html>
<html>
<body>
<p>Click below to create 4 columns</p>
<button onclick="display()">Columns</button>
<div id="myID">
This is demo text. This is demo text. This is demo text. This is demo text.
This is demo text. This is demo text. This is demo text. This is demo text.
This is demo text. This is demo text. This is demo text. This is demo text.
This is demo text. This is demo text. This is demo text. This is demo text.
This is demo text. This is demo text. This is demo text. This is demo text.
This is demo text. This is demo text. This is demo text. This is demo text.
This is demo text. This is demo text. This is demo text. This is demo text.
</div>
<script>
function display() {
document.getElementById("myID").style.columnCount = "4";
document.getElementById("myID").style.columnFill = "balance";
}
</script>
</body>
</html>热门推荐
10 新婚红包祝福语简短男
11 對好友毕业祝福语简短
12 古风中考祝福语简短
13 同学分开祝福语简短
14 培训送别祝福语简短的话
15 徒弟调走祝福语简短语
16 恭喜订婚的祝福语简短
17 生日祝福语简短激励女生
18 宝宝100日简短祝福语