3 Replies - 8595 Views - Last Post: 15 August 2011 - 05:32 AM

#1 sunjava1  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 35
  • Joined: 14-May 11

How to make a button active?

Posted 14 August 2011 - 02:36 PM

How to make a button active using css? i.e. when you click on a button it and then release your mouse then button should be in a different style indicating that this button has been clicked.




<style>


#me{

list-style:none;
background: #7AA0A3;
width:720px;
height:40px;
padding: 2px;
}

.my{

float:left;
padding:  10px 5px;
color:black;
text-decoration:none;

}

#me a:link{
color:black;
text-decoration:none;
}

#me a:visited
{
color:black;
text-decoration:none;

}

#me a:hover{

color:blue;
border: 1px outset red;


}


#me a:active{

color:magenta;
border: 3px solid green;


}








</style>


<ul id="me">

<li> <a href="#" class="my"> Home</li>
<li> <a href="#" class="my"> Search </li>


</ul>






Is This A Good Question/Topic? 0
  • +

Replies To: How to make a button active?

#2 hiddenghost  Icon User is offline

  • D.I.C Addict
  • member icon

Reputation: 39
  • View blog
  • Posts: 621
  • Joined: 15-December 09

Re: How to make a button active?

Posted 14 August 2011 - 02:59 PM

Perhaps you mean visited because if you want you're buttons to to be active that only lasts for a fraction of a second as the link loads.

Use a:visited to control how your page shows links that have 'been' clicked.

If you want the button to just stay switched to the other style only when the content specific to that button is open you'll have to ask the Javascript forum about that.

Ask about Javascript
Was This Post Helpful? 0
  • +
  • -

#3 Lemur  Icon User is offline

  • Pragmatism over Dogma
  • member icon


Reputation: 1361
  • View blog
  • Posts: 3,433
  • Joined: 28-November 09

Re: How to make a button active?

Posted 14 August 2011 - 03:00 PM

The :visited psuedo element needs to be set to something else, that will trigger if the link has been visited. If not just do a javascript onclick event.
Was This Post Helpful? 0
  • +
  • -

#4 sunjava1  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 35
  • Joined: 14-May 11

Re: How to make a button active?

Posted 15 August 2011 - 05:32 AM

I want to acomplish this as in this site,

home It is the home page, and when you click on subscribe, subscribe page the subscribe button got active, and the hover effect is different also

Attached image(s)

  • Attached Image

Was This Post Helpful? 0
  • +
  • -

Page 1 of 1