 
  Data Structure Data Structure
 Networking Networking
 RDBMS RDBMS
 Operating System Operating System
 Java Java
 MS Excel MS Excel
 iOS iOS
 HTML HTML
 CSS CSS
 Android Android
 Python Python
 C Programming C Programming
 C++ C++
 C# C#
 MongoDB MongoDB
 MySQL MySQL
 Javascript Javascript
 PHP PHP
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
How to set the style of the outline around an element with JavaScript?
To set the outline style, use the outlineStyle property. The outline can be solid, dotted, dashed, etc.
Example
You can try to run the following code to set the style of the outline around an element with JavaScript −
<!DOCTYPE html> <html>    <head>       <style>          #box {             width: 450px;             background-color: orange;             border: 3px solid red;             margin-left: 20px;          }       </style>    </head>    <body>       <p>Click below to add Outline Style.</p>       <div id="box">          <p>This is a div. This is a div. This is a div. This is a div. This is a div.</p>          <p>This is a div. This is a div. This is a div. This is a div. This is a div.</p>          <p>This is a div. This is a div. This is a div. This is a div. This is a div.</p>       </div>       <br>       <button type="button" onclick="display()">Set Outline Style</button>       <br>       <script>          function display() {             document.getElementById("box").style.outlineColor = "#5F5F5F";             document.getElementById("box").style.outlineStyle = "solid";          }       </script>    </body> </html>Advertisements
 