laponac84 Posted January 21, 2013 Share Posted January 21, 2013 how to make a:active have protperties like a:hover? i have code below, but ... active link is same as visited or usual link #flag:link and #flag:visited have black and white image #flag:hover have full color image, but #flag:active not <a href="#" id="flag" > link1 </a> #flag:link, #flag:visited{ background-image:url(../imege/flag/flagbw.jpg); display:block; height: 96px; width:128px; text-indent:-9999px; -webkit-opacity: 0.25; -moz-opacity: 0.25; opacity: 0.25; -webkit-transition: all 2s ease; -moz-transition: all 2s ease; -ms-transition: all 2s ease; -o-transition: all 2s ease; transition: all 2s ease; } #flag:hover, #flag:active{ background-image:url(../imege/flag/flag2.jpg); display:block; height: 96px; width:128px; text-indent:-9999px; -webkit-opacity: 1; -moz-opacity: 1; opacity: 1; } Quote Link to comment Share on other sites More sharing options...
Love2c0de Posted January 21, 2013 Share Posted January 21, 2013 (edited) Active only executes during the time that the mouse button is pressed down. For example, try this example and hold your mouse down on the link, you see that it sets the background to yellow. <!DOCTYPE html> <html> <head> <style> a:active { background-color:yellow; } </style> </head> <body> <a href="http://www.w3schools.com">w3schools.com</a> <a href="http://www.wikipedia.org">wikipedia.org</a> <p><b>Note:</b> The :active selector styles the active link.</p> </body> </html> I get the feeling you mean that if you go to a certain page, while you are on that page, the link will have a different style so the user can easily determine the page he's on. Is that right? Regards, L2c Edited January 21, 2013 by Love2c0de Quote Link to comment Share on other sites More sharing options...
laponac84 Posted January 24, 2013 Author Share Posted January 24, 2013 http://sportskevesti.co/balkan.php?zemlja=srbija On this link, on the left side of the page, you can see menu with the flags. hover, active, visited and link is ok... but i want to know, What do I need to add in the CSS code, to see if i read the sport news from Serbia, Serbian flags in flag menu be full color, or if you read Macedonia, Macedonian flag was in full color ... or i mast use php code if(country == "serbia"){ flag meni is like this } else is like this Quote Link to comment Share on other sites More sharing options...
Christian F. Posted January 24, 2013 Share Posted January 24, 2013 You'll need to use some server-side code, to set a new class on the link that links to the page that the user requested. Quick example: <?php // Assume that you've retrieved and validated the page variable already. // This variable is just for showcasing. $page = "srbija" if (!empty ($page)) { $active[$page] = " current"; } else { $active['index'] = " current"; } ?> <!-- Then in your menu --> <ul id="menu"> <li><a href="/" class="<?php echo $active['index'] ?: ''; ?>">Main page</a></li> <li><a href="?page=srbjia" class="<?php echo $active['srbjia'] ?: ''; ?>">Main page</a></li> </ul> As stated, this is just a quick and dirty example. If you're using a template engine, you'd be using it to insert the define class definitions in the correct place. 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.