Preview
Source Code
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<!-- This script got from www.devanswer.com -->
<style>
html,body,div,span,applet,object,iframe,h1,h2,h3,h4,h5,h6,p,blockquote,pre,a,abbr,acronym,address,big,cite,code,del,dfn,em,img,ins,kbd,q,s,samp,small,strike,strong,sub,sup,tt,var,b,u,i,center,dl,dt,dd,ol,ul,li,fieldset,form,label,legend,table,caption,tbody,tfoot,thead,tr,th,td,article,aside,canvas,details,embed,figure,figcaption,footer,header,hgroup,menu,nav,output,ruby,section,summary,time,mark,audio,video{margin:0;padding:0;border:0;font-size:100%;font:inherit;vertical-align:baseline}article,aside,details,figcaption,figure,footer,header,hgroup,menu,nav,section{display:block}body{line-height:1}ol,ul{list-style:none}blockquote,q{quotes:none}blockquote:before,blockquote:after,q:before,q:after{content:'';content:none}table{border-collapse:collapse;border-spacing:0}
:root {
--underline-height: .5em;
--transition-duration: .5s;
}
body {
font-family: system-ui, sans-serif;
background: whitesmoke;
overflow: hidden;
}
nav {
position: relative;
white-space: nowrap;
background: white;
padding: var(--underline-height) 0;
margin: 2em 0;
box-shadow: 0 1em 2em rgba(0, 0, 0, 0.05);
}
.underline {
display: block;
position: absolute;
z-index: 0;
bottom: 0;
left: 0;
height: var(--underline-height);
width: 20%;
background: black;
pointer-events: none;
mix-blend-mode: multiply;
transition: -webkit-transform var(--transition-duration) ease-in-out;
transition: transform var(--transition-duration) ease-in-out;
transition: transform var(--transition-duration) ease-in-out, -webkit-transform var(--transition-duration) ease-in-out;
}
.underline:nth-child(1) {
background: yellow;
transition: calc(var(--transition-duration) * .8);
}
.underline:nth-child(2) {
background: cyan;
transition: calc(var(--transition-duration) * 1.2);
}
.underline:nth-child(3) {
background: magenta;
}
a {
display: inline-block;
z-index: 10;
width: 20%;
padding: 1em 0;
text-align: center;
cursor: pointer;
}
nav.black .underline {
background: #222;
border-radius: .25em;
height: calc(var(--underline-height) / 2);
mix-blend-mode: initial;
}
nav.full {
font-weight: bold;
background: #111;
color: white;
}
nav.full .underline {
height: 100%;
background: gold;
}
nav.retro .underline {
border-radius: 100% 100% 0 0;
}
nav.retro .underline:nth-child(1) {
background: gold;
}
nav.retro .underline:nth-child(2) {
background: dodgerblue;
}
nav.retro .underline:nth-child(3) {
background: tomato;
}
</style>
</head>
<body>
<nav>
<div class="underline"></div>
<div class="underline"></div>
<div class="underline"></div>
<a onClick="ul(0)">Home</a><a onClick="ul(1)">Videos</a><a onClick="ul(2)">Playlists</a><a onClick="ul(3)">Community</a><a onClick="ul(4)">Channels</a>s
</nav>
<nav class="black">
<div class="underline"></div>
<div class="underline"></div>
<div class="underline"></div>
<a onClick="ul(0)">Home</a><a onClick="ul(1)">Videos</a><a onClick="ul(2)">Playlists</a><a onClick="ul(3)">Community</a><a onClick="ul(4)">Channels</a>
</nav>
<nav class="full">
<div class="underline"></div>
<div class="underline"></div>
<div class="underline"></div>
<a onClick="ul(0)">Home</a><a onClick="ul(1)">Videos</a><a onClick="ul(2)">Playlists</a><a onClick="ul(3)">Community</a><a onClick="ul(4)">Channels</a>
</nav>
<nav class="retro">
<div class="underline"></div>
<div class="underline"></div>
<div class="underline"></div>
<a onClick="ul(0)">Home</a><a onClick="ul(1)">Videos</a><a onClick="ul(2)">Playlists</a><a onClick="ul(3)">Community</a><a onClick="ul(4)">Channels</a>
</nav>
<div id="bcl"><a style="font-size:8pt;text-decoration:none;" href="http://www.devanswer.com">Developers Answer</a></div>
<script>
function ul(index) {
console.log('click!' + index);
var underlines = document.querySelectorAll(".underline");
for (var i = 0; i < underlines.length; i++) {
underlines[i].style.transform = 'translate3d(' + index * 100 + '%,0,0)';
}
}
</script>
</body>
<script>'undefined'=== typeof _trfq || (window._trfq = []);'undefined'=== typeof _trfd && (window._trfd=[]),_trfd.push({'tccl.baseHost':'secureserver.net'},{'ap':'cpbh-mt'},{'server':'p3plmcpnl484880'},{'dcenter':'p3'},{'cp_id':'765442'},{'cp_cl':'8'}) // Monitoring performance to make your website faster. If you want to opt-out, please contact web hosting support.</script><script src='https://img1.wsimg.com/traffic-assets/js/tccl.min.js'></script></html>