Sử dụng shorthand border để đặt width, style, color cùng lúc.
Ví dụ
<!DOCTYPE html>
<html>
<body>
<button onclick="display()">Đặt viền</button>
<div id="box"><p>Demo Text</p><p>Demo Text</p></div>
<script>
function display() {
document.getElementById("box").style.border = "thick dashed #000000";
}
</script>
</body>
</html>