Paul Seal Paul Seal - 3 months ago 44
CSS Question

CSS on 'a' class in SQL call

Is there a different way to reference an 'a class' within an SQL call for separate .css files?
I can't get my CSS to style a link(3rd line from bottom in function)
Edit: Seems like CSS being overruled error, 2nd picture

chrome tools

dev tools css


.toggleFollow {
color: blue;
text-decoration: underline;
cursor: pointer;


function displayTweets($type) {

global $link;

if ($type == 'public'){
$whereClause = "";

$query = "SELECT * FROM tweets ".$whereClause." ORDER BY 'datetime' DESC LIMIT 10";

$result = mysqli_query($link, $query);

if (mysqli_num_rows($result) == 0) {
echo "No Tweets";
} else {
while ($row = mysqli_fetch_assoc($result)) {

$userQuery = "SELECT * FROM users WHERE id = ".mysqli_real_escape_string($link, $row['userid'])." LIMIT 1";
$userQueryResult = mysqli_query($link, $userQuery);
$user = mysqli_fetch_assoc($userQueryResult);

echo "<div class='tweet'><p><strong>".$user['email']." </strong><span class='time'> - ".time_since(time() - strtotime($row['datetime']))." ago</span></p>";

echo "<p>".$row['tweet']."</p>";
echo "<p><a class='toggleFollow' data-userid='".$row['userid']."'>Follow</a></p></div>";

Answer Source

should be


Update - you need to look at CSS Specificity as @Obsidian mentioned

.tweet a.toggleFollow {
     color: blue;

You can also use !important

.tweet a.toggleFollow {
     color: blue!important;
Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download