spence911 Posted November 9, 2013 Share Posted November 9, 2013 I know the line below adds a table row but what is the significance of "alt"? <tr class="alt"> Quote Link to comment https://forums.phpfreaks.com/topic/283748-what-does-mean-when-creating-an-html-table/ Share on other sites More sharing options...
Ch0cu3r Posted November 9, 2013 Share Posted November 9, 2013 (edited) what is the significance of "alt"? alt is the name of the CSS class definition. Check your CSS stylesheet to see what styles are applied for that class. Edited November 9, 2013 by Ch0cu3r Quote Link to comment https://forums.phpfreaks.com/topic/283748-what-does-mean-when-creating-an-html-table/#findComment-1457650 Share on other sites More sharing options...
spence911 Posted November 9, 2013 Author Share Posted November 9, 2013 (edited) alt is the name of the CSS class definition. Check your CSS stylesheet to see what styles are applied for that class. This is a very simple HTML table. There is no CSS stylesheet. <table cell spacing = "0" border = "5" style = "width: 20 em; border: 1px solid #567;"> <tr> <th>Sequence #</th> <th>Value</th> </tr> <tr> <td>F<sub>0</sub></td> <td>0</td> </tr> <tr class = "alt"> <td>F<sub>1</sub></td> <td>1</td> </tr> </table> Edited November 9, 2013 by spence911 Quote Link to comment https://forums.phpfreaks.com/topic/283748-what-does-mean-when-creating-an-html-table/#findComment-1457655 Share on other sites More sharing options...
Solution Barand Posted November 9, 2013 Solution Share Posted November 9, 2013 you need to have defined the "alt" class in the styles eg <html> <head> <style type="text/css"> table { border-collapse: collapse; } tr { background-color: #CCCCCC; } tr.alt { background-color: #C0FFC0; } </style> </head> <body> <table border="1" cellpadding="4" cellspacing="0"> <?php $c = 'A'; for ($row=0; $row<6; $row++) { $cls = $row%2 ? '' : "class='alt'"; echo "<tr $cls>"; for ($col=0; $col<3; $col++, $c++) { echo "<td>$c</td>"; } echo "</tr>\n"; } ?> </table> </body> </html> Quote Link to comment https://forums.phpfreaks.com/topic/283748-what-does-mean-when-creating-an-html-table/#findComment-1457657 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.