0

Wanna highlight a link when you are at it?

ex-if you are at home, your home link will be conpletely highlighted.

25th Feb 2017, 12:38 PM
Tarun kumar parashar
Tarun kumar parashar - avatar
7 Answers
+ 5
The pseudo class 'active' style the link only the time the mouse button is down... 'focus' the time that the link keep the focus ( while not clicking elsewhere ) 'hover' the time the mouse is over ( or the time the element keep focus for touch devices ) That's for dynamic styling... If you want highlight menu entry corresponding to the page ( as a menu item 'activated' ), you have to style it staticly, maybe replacing the <a> link element by another ( you probaly don't want the page reload if the user click on activated/actual menu/page ) ^^
25th Feb 2017, 4:47 PM
visph
visph - avatar
+ 4
@Tarun kumar parashar wrote: "active ias not doing good as it is for less than 1sec only when it is clicked..." That's what I was specified in my previous post day before yesterday :P If you don't reload the page when clicking your menu entry, you can cheat to make them persist, by using the behavior of radio button items ( only one checked at a time / checking one deselect others ) and <label>s ( thanks to the 'for' html attribute, and css3 selectors )... Else, you just have to handle the onclick event of your menu items/links, to change classes dynamically with JS ^^
27th Feb 2017, 11:43 AM
visph
visph - avatar
+ 2
oh yes active will be used here, visited is for all the links you have clicked
25th Feb 2017, 1:36 PM
Raj Kumar Chauhan
Raj Kumar Chauhan - avatar
+ 1
use css a:visited { }
25th Feb 2017, 12:41 PM
Raj Kumar Chauhan
Raj Kumar Chauhan - avatar
+ 1
<style> a:active { background-color: yellow; } </style> Sorry iam read to fast
25th Feb 2017, 12:52 PM
Albertz
Albertz - avatar
0
thanks guys
25th Feb 2017, 1:30 PM
Tarun kumar parashar
Tarun kumar parashar - avatar
0
active ias not doing good as it is for less than 1 sec only when it is clicked..
27th Feb 2017, 11:29 AM
Tarun kumar parashar
Tarun kumar parashar - avatar