- Data Structure
- Networking
- RDBMS
- Operating System
- Java
- MS Excel
- iOS
- HTML
- CSS
- Android
- Python
- C Programming
- C++
- C#
- MongoDB
- MySQL
- Javascript
- PHP
- Physics
- Chemistry
- Biology
- Mathematics
- English
- Economics
- Psychology
- Social Studies
- Fashion Studies
- Legal Studies
- 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 border width, border style, and border color in one declaration with JavaScript?
To set the border width, style, and color in a single declaration, use the border property in JavaScript.
Example
You can try to run the following code to learn how to set border in JavaScript −
<!DOCTYPE html> <html> <body> <button onclick="display()">Set border</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>
Advertisements