php - odd even colored rows into a repeat region -
i try make work repeat region doesn't work.
<body> <?php { ?> <table class="test"> <tr> <td><?php echo $row_recordset1['fld1']; ?></td> <td>...</td> <td><?php echo $row_recordset1['fld2']; ?></td> <td>...</td> <td><?php echo $row_recordset1['fld3']; ?></td> </tr> </table> <?php } while ($row_recordset1 = mysql_fetch_assoc($recordset1)); ?> </body>
and style is
<head> <style type = "text/css"> .test tr:nth-child(even) {background: #a4d1ff;} .test tr:nth-child(odd) {background: #f2f2f2;} </style> </head>
the answer simple: take <table>
tags outside of php loop. should generating 1 set of <table>
tags @ start , end of table, not every row. once this, css stands chance of working.
Comments
Post a Comment