Để đặt tất cả thuộc tính outline trong một khai báo, dùng thuộc tính outline. Nó đặt các thuộc tính: outline-width, outline-style, và outline-color.
Ví dụ
Bạn có thể chạy mã sau để học cách làm việc với thuộc tính outline −
<!DOCTYPE html> <html> <head> <style> #box { border: 2px dashed blue; } </style> </head> <body> <div id="box">Đây là div.</div> <br> <button type="button" onclick="display()">Nhấn để đặt Outline</button> <script> function display() { document.getElementById("box").style.outline = "5px solid red"; } </script> </body> </html>