如何用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 歌词祝福语高级文案简短