I have an html table with a href link in a cell and I dont know how can I set this href link color. Background color (red) works okay but the simple "color: green" no.
else if($row['OK']=='OK') // if the word is OK
echo "<td style='background-color: red;'><div id='bot'><a href='nyugtaz.php?callsign=".$row['callsign']."'>$nyugtaze</a></div></td>";
The code is what I tried:
else if($row['OK']=='OK') // if the word is OK
echo "<td style='background-color: red; color: green'><div id='bot'><a href='nyugtaz.php?callsign=".$row['callsign']."'>$nyugtaze</a></div></td>";
You should avoid adding inline styles.
Your document will be simpler to read and maintain with an external stylesheet.
Conditionally add a class to the table cell, then leverage that class in your stylesheet.
} elseif ($row['OK'] == 'OK') {
echo "<td class='okCell'><div id='bot'><a href='nyugtaz.php?callsign=".$row['callsign']."'>{$nyugtaze}</a></div></td>";
CSS:
.okCell {
background-color: red;
}
.okCell a { # handle all of the linked/visited/etc variations if you wish
color: green;
}
I am sure I could advise a cleaner way to code this up, but you haven't offered much context.
Ps I hope that id='bot'
is unique to the page.
Try following CSS will help you.
#bot a:link, #bot a:visited{ color:black; } #bot a:hover{ color:green; }
<table> <tr> <td style='background-color: red;'><div id='bot'><a href='nyugtaz.php?callsign=".$row['callsign']."'>test</a></div></td> </tr> </table>
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.