html - How can I style a link based on my current page? -
i made navigation bar on top of screen. if i'm on specific page, let's "contact", want word highlighted. if switch "home", word "home" highlighted, , on. allowed use css , html.
body { background: black; } nav { padding:0; right:1vw; margin: 0 0 0px 0; position: fixed; top: 0vh; text-align:center; background-color:rgba(255, 255, 255, 0.4); width:98%; -moz-border-radius: 15px; border-radius: 15px; } nav li { top:2vh; font-family:verdana, geneva, sans-serif; font-size: 13pt; display: inline-block; margin-left:2vw; margin-right:2vw; margin-bottom:2vh; margin-top:2vh; } nav li { white-space: nowrap; display: block; text-decoration: none; text-transform: uppercase; text-shadow: 1px 1px 2px rgba(71, 80, 23, 0.3); color: #fff; padding: 0; letter-spacing: 1px; -webkit-transition: 0.4s ease-in-out; -moz-transition: 0.4s ease-in-out; -o-transition: 0.4s ease-in-out; -ms-transition: 0.4s ease-in-out; transition: 0.4s ease-in-out; text-align:center; } nav:hover li { } nav li a:hover { background: transparent; text-shadow: 0px 0px 20px #cc9900; color: #ffff99; }
<nav> <li><a href="/index.html">home</a></li> <li><a href="/dedump.html">de dump</a></li> <li><a href="/opdrachten.html">opdrachten</a></li> <li><a href="/groepsopdracht.html">groepsopdracht</a></li> <li><a href="/overmij.html">over mij</a></li> <li><a href="/contact.html">contact</a></li> </nav>
use following code . change accordingly
a:link, a:visited { display: block; width: 175px; font-weight: bold; color: #ffffff; background-color: #00bfff; text-align: center; padding: 4px; text-decoration: none; text-transform: uppercase; } a:hover, a:active { background-color: #0066ff; }
Comments
Post a Comment