如何使用JavaScript设置列宽和列数?
要在单个声明中设置列宽和列数,请使用JavaScriptcolumns属性。
示例
您可以尝试运行以下代码以使用JavaScript设置列宽和列数-
<!DOCTYPE html>
<html>
<head>
<style>
#myID {
column-count: 4;
column-rule: 4px solid yellow;
}
</style>
</head>
<body>
<p>Click below to change the column count to 2 and minimum size</p>
<button onclick="display()">Change Column count and set size</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.columns = "70px 2";
}
</script>
</body>
</html>热门推荐
10 赞美老师祝福语英文简短
11 迎接朋友蛋糕祝福语简短
12 财神祝福语简短情话文案
13 单位搬迁新楼祝福语简短
14 男士送花祝福语大全简短
15 离职横幅升职祝福语简短
16 姑娘生日祝福语简短的话
17 公司商务中秋祝福语简短
18 奥运早安祝福语简短英文