Flat Navigation

Size
2,707 Kb
Views
38,456

How do I make an flat navigation?

Inspired by Asif Aleem's work on Dribbble http://drbl.in/ieQh. What is a flat navigation? How do you make a flat navigation? This script and codes were developed by Mojtaba Seyedi on 27 July 2022, Wednesday.

Flat Navigation Previews

Flat Navigation - Script Codes HTML Codes

<!DOCTYPE html>
<html >
<head> <meta charset="UTF-8"> <title>Flat Navigation</title> <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/meyer-reset/2.0/reset.min.css"> <style> /* NOTE: The styles were added inline because Prefixfree needs access to your styles and they must be inlined if they are on local disk! */ body { background-color: #1b1b1b;
}
nav { width : 330px; margin: 0 auto;
}
menu:after , menu:before { display : table; content : ' ';
}
menu:after { clear : both;
}
li { background-color : #fff; list-style-type: none; float : left; margin-right : 1px;
}
li a { position: relative; display : block; text-align : center; text-decoration: none; width : 62px; height : 66px;
}
a span { display : block; font-size : 32px; padding : 20px 15px; color : #222; position: absolute; top : 0; left : 0; z-index : 100; transition : all .2s;
}
a:before { display: block; content : ' '; position: absolute; transition : all .2s;
}
a:hover span { color : #fff; transition : all .2s;
}
a:hover:before { transition : all .3s;
}
.c1:before{ background-color: #b651d8;
}
.c2:before { background-color: #71c55e;
}
.c3:before { background-color: #fab904;
}
.c4:before { background-color: #e94739;
}
.c5:before { background-color: #407ded;
}
hr { width : 100px; margin : 50px auto;
}
/* Top
********************/
nav.top
a:before { top : 0; left : 0; height : 5px; width : 100%;
}
nav.top
a:hover:before { height : 100%;
}
/* left
********************/
nav.left
a:before { top : 0; left : 0; height : 100%; width : 5px;
}
nav.left
a:hover:before { width : 100%;
}
/* bottom
********************/
nav.bottom
a:before { bottom : 0; left : 0; height : 5px; width : 100%;
}
nav.bottom
a:hover:before { height : 100%;
}
/* right
********************/
nav.right
a:before { top : 0; right : 0; width : 5px; height : 100%;
}
nav.right
a:hover:before { width : 100%;
} </style> <script src="https://cdnjs.cloudflare.com/ajax/libs/prefixfree/1.0.7/prefixfree.min.js"></script>
</head>
<body> <nav class="top"> <menu> <li> <a class="c1" href="#" > <span>☀</span> </a> </li> <li> <a class="c2" href="#" > <span>✈</span> </a> </li> <li> <a class="c3" href="#" > <span>❄</span> </a> </li> <li> <a class="c4" href="#" > <span>☎</span> </a> </li> <li> <a class="c5" href="#" > <span>✉</span> </a> </li> </menu>
</nav>
<hr />
<nav class="left"> <menu> <li> <a class="c1" href="#" > <span>☀</span> </a> </li> <li> <a class="c2" href="#" > <span>✈</span> </a> </li> <li> <a class="c3" href="#" > <span>❄</span> </a> </li> <li> <a class="c4" href="#" > <span>☎</span> </a> </li> <li> <a class="c5" href="#" > <span>✉</span> </a> </li> </menu>
</nav>
<hr />
<nav class="bottom"> <menu> <li> <a class="c1" href="#" > <span>☀</span> </a> </li> <li> <a class="c2" href="#" > <span>✈</span> </a> </li> <li> <a class="c3" href="#" > <span>❄</span> </a> </li> <li> <a class="c4" href="#" > <span>☎</span> </a> </li> <li> <a class="c5" href="#" > <span>✉</span> </a> </li> </menu>
</nav>
<hr />
<nav class="right"> <menu> <li> <a class="c1" href="#" > <span>☀</span> </a> </li> <li> <a class="c2" href="#" > <span>✈</span> </a> </li> <li> <a class="c3" href="#" > <span>❄</span> </a> </li> <li> <a class="c4" href="#" > <span>☎</span> </a> </li> <li> <a class="c5" href="#" > <span>✉</span> </a> </li> </menu>
</nav>
</body>
</html>

Flat Navigation - Script Codes CSS Codes

body { background-color: #1b1b1b;
}
nav { width : 330px; margin: 0 auto;
}
menu:after , menu:before { display : table; content : ' ';
}
menu:after { clear : both;
}
li { background-color : #fff; list-style-type: none; float : left; margin-right : 1px;
}
li a { position: relative; display : block; text-align : center; text-decoration: none; width : 62px; height : 66px;
}
a span { display : block; font-size : 32px; padding : 20px 15px; color : #222; position: absolute; top : 0; left : 0; z-index : 100; transition : all .2s;
}
a:before { display: block; content : ' '; position: absolute; transition : all .2s;
}
a:hover span { color : #fff; transition : all .2s;
}
a:hover:before { transition : all .3s;
}
.c1:before{ background-color: #b651d8;
}
.c2:before { background-color: #71c55e;
}
.c3:before { background-color: #fab904;
}
.c4:before { background-color: #e94739;
}
.c5:before { background-color: #407ded;
}
hr { width : 100px; margin : 50px auto;
}
/* Top
********************/
nav.top
a:before { top : 0; left : 0; height : 5px; width : 100%;
}
nav.top
a:hover:before { height : 100%;
}
/* left
********************/
nav.left
a:before { top : 0; left : 0; height : 100%; width : 5px;
}
nav.left
a:hover:before { width : 100%;
}
/* bottom
********************/
nav.bottom
a:before { bottom : 0; left : 0; height : 5px; width : 100%;
}
nav.bottom
a:hover:before { height : 100%;
}
/* right
********************/
nav.right
a:before { top : 0; right : 0; width : 5px; height : 100%;
}
nav.right
a:hover:before { width : 100%;
}
Flat Navigation - Script Codes
Flat Navigation - Script Codes
Home Page Home
Developer Mojtaba Seyedi
Username seyedi
Uploaded July 27, 2022
Rating 4
Size 2,707 Kb
Views 38,456
Do you need developer help for Flat Navigation?

Find the perfect freelance services for your business! Fiverr's mission is to change how the world works together. Fiverr connects businesses with freelancers offering digital services in 500+ categories. Find Developer!

Mojtaba Seyedi (seyedi) Script Codes
Create amazing marketing copy with AI!

Jasper is the AI Content Generator that helps you and your team break through creative blocks to create amazing, original content 10X faster. Discover all the ways the Jasper AI Content Platform can help streamline your creative workflows. Start For Free!