HTML Editor
<!DOCTYPE html> <html lang="en-US"> <head> <style> table, td, th{ border: 1px solid black; } </style> </head> <body> <h1>CSS border-collapse Property</h1> <table> <tr> <th>Name</th> <th>Age</th> </tr> <tr> <td>Jos</td> <td>28</td> </tr> <tr> <td>Alex</td> <td>34</td> </tr> </table> <button onclick="myFunction()">Click Me</button> <script> var x = document.getElementsByTagName("table")[0]; function myFunction(){ x.style.borderCollapse = "collapse"; } </script> <p><strong>Note</strong>: Click on the button to change the 'border-collapse' from 'separate' (default) to 'collapse'.</p> </body> </html>
OUTPUT
×

Save as Private