Source Code:
(back to article)
Submit
Result:
Report an issue
<!DOCTYPE html> <html> <head> <title>Title of the document</title> <style> div { overflow-x: auto; } table { border-collapse: collapse; width: 100%; } th, td { text-align: left; padding: 8px 5px; } tr:nth-child(even) { background-color: #6eeccf; } tr:nth-child(odd) { background-color: #2d7f88; } </style> </head> <body> <h2>Responsive table example</h2> <div> <table> <tr> <th>First Name</th> <th>Last Name</th> <th>Money</th> <th>Money</th> <th>Money</th> <th>Money</th> <th>Money</th> <th>Money</th> <th>Money</th> <th>Money</th> <th>Money</th> <th>Money</th> </tr> <tr> <td>Sherlock</td> <td>Holmes</td> <td>$150</td> <td>$150</td> <td>$150</td> <td>$150</td> <td>$150</td> <td>$150</td> <td>$150</td> <td>$150</td> <td>$150</td> <td>$150</td> </tr> <tr> <td>John</td> <td>Watson</td> <td>$350</td> <td>$350</td> <td>$350</td> <td>$350</td> <td>$350</td> <td>$350</td> <td>$350</td> <td>$350</td> <td>$350</td> <td>$350</td> </tr> <tr> <td>Mary</td> <td>Watson</td> <td>$500</td> <td>$500</td> <td>$500</td> <td>$500</td> <td>$500</td> <td>$500</td> <td>$500</td> <td>$500</td> <td>$500</td> <td>$500</td> </tr> </table> </div> </body> </html>