Thuộc tính columnRuleWidth dùng để thiết lập hoặc lấy độ dày đường phân cách giữa các cột.
Cú pháp
object.style.columnRuleWidth = "medium|thin|thick|length|initial|inherit"
Giá trị tham số
| Giá trị | Mô tả |
|---|---|
| thin | Đường mỏng |
| medium | Đường trung bình (mặc định) |
| thick | Đường dày |
| length | Độ dày cụ thể (px, em, rem...) |
| initial | Giá trị mặc định |
| inherit | Kế thừa từ phần tử cha |
Ví dụ minh họa
<!DOCTYPE html>
<html>
<head>
<style>
#DIV1 {
padding: 5px;
column-count: 5;
column-rule-width: 9px;
column-rule-color: lightblue;
column-rule-style: solid;
}
</style>
<script>
function changeColumnRuleWidth() {
document.getElementById("DIV1").style.columnRuleWidth = "3px";
document.getElementById("Sample").innerHTML = "Độ dày column rule đã được giảm xuống";
}
</script>
</head>
<body>
<div id="DIV1">
<img src="https://www.tutorialspoint.com/images/Swift.png"><br/>
<img src="https://www.tutorialspoint.com/images/xamarian.png"><br/>
<img src="https://www.tutorialspoint.com/images/pl-sql.png"><br/>
<img src="https://www.tutorialspoint.com/images/asp-net.png"><br/>
<img src="https://www.tutorialspoint.com/images/powerbi.png"><br/>
<img src="https://www.tutorialspoint.com/images/Tableau.png"><br/>
<img src="https://www.tutorialspoint.com/images/Big-Data-Analytics.png"><br/>
<img src="https://www.tutorialspoint.com/images/microsoftproject.png"><br/>
<img src="https://www.tutorialspoint.com/images/QlikView.png"><br/>
<img src="https://www.tutorialspoint.com/images/hadoop.png">
</div>
<p>Thay đổi column rule width của div trên bằng cách nhấn nút dưới đây</p>
<button onclick="changeColumnRuleWidth()">Thay đổi Column Rule Width</button>
<p id="Sample"></p>
</body>
</html>
Kết quả
Ban đầu đường phân cách dày 9px solid lightblue. Sau khi nhấn nút, giảm còn 3px.