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

Popular posts from this blog

maven fortify plugin : Unable to load build session with ID XXXXX .. See log file for more details -

c# - Primavera WebServices does not return any data -

android - Display emoji panel with genymotion - keyboard/touch input? -