i want that when i click this link its color changes to the given color
<li id="press"><a href="<?=base_url()?>index.php/page/press">Press</a></li>
To change the color of links in HTML, use the CSS property color. Use it with the style attribute. The style attribute specifies an inline style for an element. Use the style attribute with the CSS property color to change the link color.
To change the color of hyperlink text, click Hyperlink, and then click More Colors. To change the color of the followed hyperlink text, click Followed Hyperlink, and then click More Colors.
Use HTML DOM Style backgroundColor Property to change the background color after clicking the button. This property is used to set the background-color of an element.
The CSS declaration :active
will accomplish what you're after. http://www.w3schools.com/CSS/pr_pseudo_active.asp
Example.
a:active {
color: #C00;
}
NB.
a:active
MUST come after a:hover
in the CSS definition in order to be effective!
Here is the sample Css for the visited hyperlink
a:link {color:#FF0000}
a:visited{color:Red}
Hope that will help.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With