Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <!DOCTYPE html>
- <html>
- <head>
- <style>
- body{
- font-family: Arial, Helvetica, sans-serif;
- }
- .tableClean {
- border-collapse: collapse;
- color:#555555;
- }
- .tableClean tr{
- border-left: 1px solid #cccccc;
- border-right: 1px solid #cccccc;
- }
- .tableClean tr:last-child{
- border-bottom: 1px solid #cccccc;
- }
- .tableClean tr:first-child{
- border-top: 1px solid #cccccc;
- background-color: #cccccc;
- }
- .tableClean td, .tableClean th{
- padding:0.75em;
- }
- .tdBlue{
- color:#000055;
- background-color: cornflowerblue;
- }
- .trGreen{
- color:#005500;
- background-color: darkseagreen;
- }
- </style>
- </head>
- <body>
- <table class="tableClean">
- <tr>
- <th>Header A</th>
- <th>Header B</th>
- <th>Header C</th>
- </tr>
- <tr>
- <td>Content 1a</td>
- <td>Content 1b</td>
- <td class="tdBlue">.tdBlue</td>
- </tr>
- <tr>
- <td>Content 2a</td>
- <td>Content 2b</td>
- <td>Content 2c</td>
- </tr>
- </table>
- <script>
- var thisSourceList = document.querySelectorAll(".tdBlue");
- for(var i = 0; i < thisSourceList.length; i++) {
- thisSourceList[i].parentNode.classList.add("trGreen");
- }
- </script>
- </body>
- </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement