如何使用JavaScript设置列规则属性?
该columnRule属性在JavaScript中使用设置列规则。它使您可以设置列规则之间的样式,颜色和宽度。
示例
您可以尝试运行以下代码以使用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.columnRule = "2px outset red"; } </script> </body> </html>