php - How to apply style in an echo'ed ? -
php - How to apply style in an echo'ed <td>? -
this php code:
$query="select name, surname, address employee"; $results = mysql_query($query); while ($row = mysql_fetch_assoc($results)) { echo '<tr>'; foreach($row $field) { echo '<td class="element">' . htmlspecialchars($field) . '</td>'; } echo '</tr>';
and css:
.element{ color:red; }
but fields displayed in html page aren't red. why doesn't work?
i tried
echo "<td class='element'>" . htmlspecialchars($field) . "</td>";
and
echo '<td class=\"element\">' . htmlspecialchars($field) . "</td>";
but no success.
i suggest specify element in css.
td.element{ color:red; }
also it's thought give "tr" id "tr id="mytr"...
#mytr td.element{ color:red; }
php html css
Comments
Post a Comment