如何使用JavaScript设置列之间的间隔?
要设置列之间的间隔,请使用columnGap属性。
示例
您可以尝试运行以下代码,以了解如何使用JavaScript设置列之间的间隔-
<!DOCTYPE html>
<html>
<body>
<p>Click below to create 4 columns and set gap of 30px</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.columnGap = "30px";
}
</script>
</body>
</html>热门推荐
7 薛之谦祝福语简短
10 五十二新年祝福语简短
11 给老板祝福语简短精辟
12 祝福语简短创意闺蜜
13 庆祝国家的祝福语简短
14 白羊生日祝福语 简短独特
15 毕业结婚祝福语简短精辟
16 租房明天搬家祝福语简短
17 工厂祝福语简短10字
18 小红书生日祝福语简短