css3 - Navigation Bar Current state -
hi made navigation website. change color of links when go page. example click "about" go page link turn red when in page.
how can that? thank you!
here codes
html
<nav> <ul> <li><a href="index.htm">home</a></li> <li><a href="about.htm">about</a></li> <li><a href="#">services</a></li> <li><a href="#">creatives less</a></li> <li><a href="#">blogs</a></li> <li><a href="#">contact</a></li> </ul> </nav>
css:
nav { float: right; margin-top: 13px; margin-right: 40px; } nav ul { font-family: josefin; list-style-type: none; font-size: 11pt; text-transform: uppercase; } nav li { display: inline; padding-left: 15px; } nav li a{ text-decoration: none; color: #0ff; } nav li a:hover, a:active { color: #fff; }
you can add css class javascript or server-side language.
if you'll use javascript should find indicates user on page (some div information example). , then, if use jquery, add class:
$('#mylink').addclass('active');
Comments
Post a Comment