Woxy Posted July 1, 2009 Share Posted July 1, 2009 Hello all! I may be a noob when it comes to PHP but i still can't understand why this doesn't work: echo "<li><a href=game.php?id=$row[1]><span class=linky>$row[1]</span></a><br></li>"; .linky { a:link color: #FFA200; a:visited color: #878787; a:active letter-spacing: 5px; a:hover text-decoration:none; color:#FFFFFF; } The links come out 100% standard however i do. Quote Link to comment Share on other sites More sharing options...
Adam Posted July 1, 2009 Share Posted July 1, 2009 Try this.. echo '<li><a href="game.php?id=' . $row[1] . '"><span class="linky">' . $row[1] . '</span></a><br></li>'; Quote Link to comment Share on other sites More sharing options...
Adam Posted July 1, 2009 Share Posted July 1, 2009 Oh no, wait, the styles are all wrong... .linky { color: #FFA200; color: #878787; letter-spacing: 5px; text-decoration:none; color:#FFFFFF; } --edit-- Learn CSS... http://www.w3schools.com/css/ Quote Link to comment Share on other sites More sharing options...
Woxy Posted July 1, 2009 Author Share Posted July 1, 2009 You sure that's right? They changed but nothing happens when i hover over them. Quote Link to comment Share on other sites More sharing options...
Adam Posted July 1, 2009 Share Posted July 1, 2009 http://www.google.co.uk/search?q=css+anchors Quote Link to comment Share on other sites More sharing options...
Woxy Posted July 1, 2009 Author Share Posted July 1, 2009 Found a guide and tried their technique; a.column:link {color: #009900;} a.column:visited {color: #999999;} a.column:hover {color: #333333;} a.column:focus {color: #333333;} a.column:active {color: #009900;} So here's my css file now: a.linky:link {color: #009900;} a.linky:visited {color: #999999;} a.linky:hover {color: #333333;} The links colors changed to white, but they're still in Times New Roman and nothing happens when i hover over them... EDIT: For some reason, the links colored are back to standard again... Quote Link to comment Share on other sites More sharing options...
bmw2213 Posted July 1, 2009 Share Posted July 1, 2009 Found a guide and tried their technique; a.column:link {color: #009900;} a.column:visited {color: #999999;} a.column:hover {color: #333333;} a.column:focus {color: #333333;} a.column:active {color: #009900;} So here's my css file now: a.linky:link {color: #009900;} a.linky:visited {color: #999999;} a.linky:hover {color: #333333;} The links colors changed to white, but they're still in Times New Roman and nothing happens when i hover over them... EDIT: For some reason, the links colored are back to standard again... That's because when you do the link code in the html you need to add the class there. So it should be <a class="linky" href="link.com">Link</a> Quote Link to comment Share on other sites More sharing options...
Woxy Posted July 1, 2009 Author Share Posted July 1, 2009 That worked... Once. When I now try to change the colors it won't apply. How can this be? Quote Link to comment Share on other sites More sharing options...
bmw2213 Posted July 1, 2009 Share Posted July 1, 2009 What does your code look like? Quote Link to comment Share on other sites More sharing options...
Woxy Posted July 1, 2009 Author Share Posted July 1, 2009 They colors have applied now. Maybe I just left something out. Only one thing left now: How do i change font and text-decoration of the links? Quote Link to comment Share on other sites More sharing options...
haku Posted July 2, 2009 Share Posted July 2, 2009 font-family: a_font b_font c_font; text-decoration: underline; Quote Link to comment Share on other sites More sharing options...
Woxy Posted July 2, 2009 Author Share Posted July 2, 2009 I know that, but how do I apply the code to the php? Quote Link to comment Share on other sites More sharing options...
departedmind Posted July 2, 2009 Share Posted July 2, 2009 font-family: a_font b_font c_font; text-decoration: underline; Write those styles in your css class (linky) and apply this class while you echo through PHP on <a> tag. Quote Link to comment Share on other sites More sharing options...
haku Posted July 2, 2009 Share Posted July 2, 2009 You don't apply CSS to php, you apply it to the (X)HTML that the php outputs. Quote Link to comment Share on other sites More sharing options...
Woxy Posted July 2, 2009 Author Share Posted July 2, 2009 Tried that, did nothing. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.