ilikephp Posted June 8, 2008 Share Posted June 8, 2008 hello, I have this code: a { font-family: Arial, Helvetica, sans-serif; font-size: 14px; color: #990000; text-decoration: none; font-weight: bold } a:hover { font-family: Arial, Helvetica, sans-serif; font-size: 14px; color: #990000; text-decoration: underline; font-weight: bold } How can I choose which color to be displayed for some links when the mouse is rolled over them? For example: read more: will be displayed in red and bold and if I want: continue: to be in blue when clicked, what can I do plz? Thxx... Link to comment https://forums.phpfreaks.com/topic/109295-hyperlink-roll-over/ Share on other sites More sharing options...
Psycho Posted June 8, 2008 Share Posted June 8, 2008 1. This is not a JavaScript questin it is a CSS question. 2. You do not need to specify properties in the "a:hover" option if they are the same in the standard "a" class. You just need to use named classes to achieve this Example: <html> <head> <style> a { font-family: Arial, Helvetica, sans-serif; font-size: 14px; text-decoration: none; font-weight: bold } a:hover { text-decoration: underline; } .red { color: #990000; } .blue { color: #000099; } </style> </head> <body> <a href="#" class="red">Link 1</a><br> <a href="#" class="blue">Link 2</a><br> </body> </html> Link to comment https://forums.phpfreaks.com/topic/109295-hyperlink-roll-over/#findComment-560647 Share on other sites More sharing options...
ilikephp Posted June 12, 2008 Author Share Posted June 12, 2008 THANKS !!! (y) Link to comment https://forums.phpfreaks.com/topic/109295-hyperlink-roll-over/#findComment-564060 Share on other sites More sharing options...
ilikephp Posted June 14, 2008 Author Share Posted June 14, 2008 hi again!! in this fuction below, can I add a color for "a" so the hyperlink will be taken automatically? a { font-family: Arial, Helvetica, sans-serif; font-size: 14px; text-decoration: none; font-weight: bold } for example: can hover take the color that is put by default? can I put this without the class? <a href="#" >Link 1</a><br> Link to comment https://forums.phpfreaks.com/topic/109295-hyperlink-roll-over/#findComment-565457 Share on other sites More sharing options...
xtopolis Posted June 14, 2008 Share Posted June 14, 2008 a:hover { color: blue; } You can modify the "a" properties anyway you like. a:link, a:visited, a:hover, a:active Although, if I recall, you need to define them in a certain order... Not sure. Link to comment https://forums.phpfreaks.com/topic/109295-hyperlink-roll-over/#findComment-565471 Share on other sites More sharing options...
ilikephp Posted June 14, 2008 Author Share Posted June 14, 2008 can I put the a:active to get the color that is displayed automatically so it will not change? coz I have many links in different colors: link1 link2 link3 Link to comment https://forums.phpfreaks.com/topic/109295-hyperlink-roll-over/#findComment-565486 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.