Diagonal Nav bar

Developer
Size
2,392 Kb
Views
28,336

How do I make an diagonal nav bar?

Using ::before and ::after to create a diagonal style navigation . What is a diagonal nav bar? How do you make a diagonal nav bar? This script and codes were developed by Nick Colley on 12 November 2022, Saturday.

Diagonal Nav bar Previews

Diagonal Nav bar - Script Codes HTML Codes

<!DOCTYPE html>
<html >
<head> <meta charset="UTF-8"> <title>Diagonal Nav bar</title> <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/normalize/5.0.0/normalize.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! */ * { box-sizing: border-box; }
ul { height: 2.500em; width: 100%; padding: 0; margin: 0; background: #EEE; font-size: 16px;
}
li { position: relative; display: block; float: left; margin-right: 1.563em; height: 100%; width: 6.25em; cursor: pointer; user-select: none; background: #EEE; color: #555; text-align: center; line-height: 2.5em;
}
li::before { content: ''; position: absolute; display: block; left: -1.5em; width: 0; height: 0; border-top: 2.5em solid transparent; border-right: 1.563em solid #EEE;
}
li::after { content: ''; position: absolute; display: block; top: 0; right: -1.5em; width: 0; height: 0; border-top: 2.5em solid #EEE; border-right: 1.563em solid transparent;
}
/* Hover */
li:hover { color: #666; background: #CCC;
}
li:hover::after { border-top: 2.5em solid #CCC; border-right: 1.563em solid transparent;
}
li:hover::before { border-top: 2.5em solid transparent; border-right: 1.563em solid #CCC;
}
/* Active */
li:active { color: #BBB; background: #DDD;
}
li:active::after { border-top: 2.5em solid #DDD; border-right: 1.563em solid transparent;
}
li:active::before { border-top: 2.5em solid transparent; border-right: 1.563em solid #DDD;
} </style> <script src="https://cdnjs.cloudflare.com/ajax/libs/prefixfree/1.0.7/prefixfree.min.js"></script>
</head>
<body> <ul> <li>Home</li> <li>Contact</li> <li>Contact</li> <li>About</li>
</ul> <script src='http://cdnjs.cloudflare.com/ajax/libs/jquery/2.1.3/jquery.min.js'></script>
</body>
</html>

Diagonal Nav bar - Script Codes CSS Codes

* { box-sizing: border-box; }
ul { height: 2.500em; width: 100%; padding: 0; margin: 0; background: #EEE; font-size: 16px;
}
li { position: relative; display: block; float: left; margin-right: 1.563em; height: 100%; width: 6.25em; cursor: pointer; user-select: none; background: #EEE; color: #555; text-align: center; line-height: 2.5em;
}
li::before { content: ''; position: absolute; display: block; left: -1.5em; width: 0; height: 0; border-top: 2.5em solid transparent; border-right: 1.563em solid #EEE;
}
li::after { content: ''; position: absolute; display: block; top: 0; right: -1.5em; width: 0; height: 0; border-top: 2.5em solid #EEE; border-right: 1.563em solid transparent;
}
/* Hover */
li:hover { color: #666; background: #CCC;
}
li:hover::after { border-top: 2.5em solid #CCC; border-right: 1.563em solid transparent;
}
li:hover::before { border-top: 2.5em solid transparent; border-right: 1.563em solid #CCC;
}
/* Active */
li:active { color: #BBB; background: #DDD;
}
li:active::after { border-top: 2.5em solid #DDD; border-right: 1.563em solid transparent;
}
li:active::before { border-top: 2.5em solid transparent; border-right: 1.563em solid #DDD;
}
Diagonal Nav bar - Script Codes
Diagonal Nav bar - Script Codes
Home Page Home
Developer Nick Colley
Username nickcolley
Uploaded November 12, 2022
Rating 3
Size 2,392 Kb
Views 28,336
Do you need developer help for Diagonal Nav bar?

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!

Nick Colley (nickcolley) Script Codes
Create amazing sales emails 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!