i have a button. i want it so that when user click on it, it should stay ative. but this code below doesnt stay active. i am trying to get a toggle effect but when user click on it it stay active any cant go back,

<button type='submit' id='button1' class='button' name='button_1'>button1</button>


#button1
{
 color:white;
}

#button1:active
{
 color:green;
}

After :active it will use :visited. However, if you are paranoid like me and have browser history disabled, the next time I visit the page it will be normal again (not active, and not visited).

#button1:active, #button1:visited { color: green; }
Be a part of the DaniWeb community

We're a friendly, industry-focused community of 1.19 million developers, IT pros, digital marketers, and technology enthusiasts learning and sharing knowledge.