Jump to content


active link properties

  • Please log in to reply
3 replies to this topic

#1 laponac84

  • Members
  • PipPip
  • Member
  • 13 posts

Posted 21 January 2013 - 04:04 PM

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" >

#flag:link, #flag:visited{
     height: 96px;
     -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{
     height: 96px;
     -webkit-opacity: 1;
   -moz-opacity: 1;
   opacity: 1;

#2 Love2c0de

  • Members
  • PipPipPip
  • Advanced Member
  • 366 posts
  • LocationThe Pleiades
  • Age:23

Posted 21 January 2013 - 07:32 PM

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>

<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>


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?



Edited by Love2c0de, 21 January 2013 - 07:33 PM.

#3 laponac84

  • Members
  • PipPip
  • Member
  • 13 posts

Posted 24 January 2013 - 11:25 AM

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

#4 Christian F.

Christian F.
  • Staff Alumni
  • Advanced Member
  • 3,106 posts
  • LocationNorway

Posted 24 January 2013 - 12:01 PM

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:
// 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>

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.
Keeping it simple.

0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users