Jump to content

change colour of visited link


vinpkl

Recommended Posts

hi all

 

i have 10 links.

and i want that only the visited active link should change colour and the rest links should automatically change back to normal as unvisited links whether they have been visited on not.

 

i m using IE7 and Firefox 3. my css is not working.

 

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<title>Untitled Document</title>
<style>
a:link{
background-color:#000000;
font-family:Arial, Helvetica, sans-serif;
font-size:12px;
color:#ffffff;
height:60px;
padding:4px;
margin:10px;
display:block;
width:20px;
}
a:visited{
background-color:#ff0000;
font-family:Arial, Helvetica, sans-serif;
font-size:12px;
color:#ffffff;
height:60px;
padding:4px;
margin:10px;
display:block;
width:20px;
}
a:active{
background-color:#000000;
font-family:Arial, Helvetica, sans-serif;
font-size:12px;
color:#ffffff;
height:60px;
padding:4px;
margin:10px;
display:block;
width:20px;
}
a:hover{
background-color:#000000;
font-family:Arial, Helvetica, sans-serif;
font-size:12px;
color:#ffffff;
height:60px;
padding:4px;
margin:10px;
display:block;
width:20px;
}
</style>
</head>

<body>
<a href="#">1</a> <a href="#">2</a> <a href="#">3</a> <a href="#">4</a>
</body>
</html>

 

vineet

Link to comment
Share on other sites

because all the colours are the same?? maybe.

 

there all set as : color:#ffffff;

 

 

<style>
a:link{
background-color:#000000;
   font-family:Arial, Helvetica, sans-serif;
   font-size:12px;
   color:#ffffff;
   height:60px;
   padding:4px;
   margin:10px;
display:block;
width:20px;
   }
a:visited{
background-color:#ff0000;
   font-family:Arial, Helvetica, sans-serif;
   font-size:12px;
   color:pink; //  <------------- change that colour i like pink tho haha 
   height:60px;
   padding:4px;
   margin:10px;
display:block;
width:20px;
   }
a:active{
   background-color:#000000;
   font-family:Arial, Helvetica, sans-serif;
   font-size:12px;
   color:#ffffff;
   height:60px;
   padding:4px;
   margin:10px;
display:block;
width:20px;
   }
a:hover{
   background-color:#000000;
   font-family:Arial, Helvetica, sans-serif;
   font-size:12px;
   color:#ffffff;
   height:60px;
   padding:4px;
   margin:10px;
display:block;
width:20px;
   }
</style>

Link to comment
Share on other sites

<style type="text/css">
A:link {background: #FFCC00; text-decoration: none}
A:visited {background: black; text-decoration: none}
A:active {background: #FFCC00; text-decoration: none}
A:hover {background: #FFCC00; font-weight:bold; color: red;}
</style>

 

just mess around with that.

Link to comment
Share on other sites

<style type="text/css">
A:link {background: #FFCC00; text-decoration: none}
A:visited {background: black; text-decoration: none}
A:active {background: #FFCC00; text-decoration: none}
A:hover {background: #FFCC00; font-weight:bold; color: red;}
</style>

 

just mess around with that.

 

hi burnside

 

these kind of changes i have applied many times but the problem is when a links has been clicked once whether it has a background or no background ,

it dont change its state to unclicked link when the other link is clicked. it remains as a visited link till u delete cache.

 

 

vineet

Link to comment
Share on other sites

but that you want isnt realy a visited link as soon as you click a diffrent link you want it to go back to default, whats the point lol?

 

i want exactly the same what i told you about forum paging.

 

if i have 10 links then i click any of the link. then only that clicked link should be highlighted to show i am on that page whether i have clicked 2 links before that link or 5 links before that link.

 

like i went to page 5 from pages 1,2,3,4 then only page number 5 should be highlighted not rest 1,2,3,4 that i visited before moving to page 5

 

vineet

Link to comment
Share on other sites

ah i see now.

 

well the way that is done in the pagin tutorial is by a database,

 

// loop to show links to range of pages around current page
for ($x = ($currentpage - $range); $x < (($currentpage + $range) + 1); $x++) {
   // if it's a valid page number...
   if (($x > 0) && ($x <= $totalpages)) {
      // if we're on current page...
      if ($x == $currentpage) {
         // 'highlight' it but don't make a link
         echo " [<b>$x</b>] ";
      // if not current page...
      } else {
         // make it a link
 echo " <a href='{$_SERVER['PHP_SELF']}?currentpage=$x'>$x</a> ";
      } // end else
   } // end if 
} // end for

 

but for that to work its php and not css, other than that i have no idea how to do what your asking.

Link to comment
Share on other sites

well burnside

 

i also needed to use the css styles in my paging but not able to apply style on them. here is my for loop

<?
echo "No. of Pages »  ";
    //use $sql with a MySQL query operation: mysql_query($sql) ... etc
    for ($i = 1; $i <= $total_pages; $i++) {
        if ($i == $page) {
            $class = 'class="paging"';
            $prepend = 'Page ';
}
echo "<a href=products-".$dealer_id."-". $category_id. "-". $i. ".html" . $class . ">" .$prepend. $i . "</a>\n";
        unset($class, $prepend);
       
}
?>

 

can u help me out in this. i want to hightlight the visited page number only. other links should become back normal.

 

vineet

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.