Inspiration for Line Menu Styles

Some ideas for menu styles and effects that employ the line as a creative design element. This is an open collection; contributions are welcome!

From our sponsor: Get started on your Squarespace website with a free trial

The line is an amazing design element. It’s so versatile and it allows us to use it for adding enjoyable animations or enhance points of interest. Today we’d like to share a set of ideas for using the line as a design element in horizontal menus. There are many creative possibilities, some minuscule and subtle, others bold and more extravagant. We’ve prepared a little inspirational set for you where we explore some line menu styles.

We’d also like to invite you to contribute your style to this open collection. Check out the details on GitHub.


Let’s have a look at the markup which is, aside from some exceptions, the same for every menu style:

<section class="section section--menu" id="Prospero">

	<h2 class="section__title">Prospero</h2>

	<nav class="menu menu--prospero">

		<ul class="menu__list">
			<li class="menu__item menu__item--current">
				<a class="menu__link">Home</a>
			<li class="menu__item">
				<a class="menu__link">Who we are</a>
			<li class="menu__item">
				<a class="menu__link">What we offer</a>
			<li class="menu__item">
				<a class="menu__link">Our news</a>
			<li class="menu__item">
				<a class="menu__link">Contact us</a>


The menu__item--current class indicates the currently selected item. Note that we use a BEM naming convention but allow for the main nav to have an indicative class that we then use in our stylesheet (component.css) to define the individual styles.

Let’s have a look at the common styles for all menus:

.menu {
	line-height: 1;
	margin: 0 auto 3em;

.menu__list {
	position: relative;
	display: -webkit-flex;
	display: flex;
	-webkit-flex-wrap: wrap;
	flex-wrap: wrap;
	margin: 0;
	padding: 0;
	list-style: none;

.menu__item {
	display: block;
	margin: 1em 0;

.menu__link {
	font-size: 1.05em;
	font-weight: bold;
	display: block;
	padding: 1em;
	cursor: pointer;
	-webkit-user-select: none;
	-moz-user-select: none;
	-ms-user-select: none;
	user-select: none;
	-webkit-touch-callout: none;
	-khtml-user-select: none;
	-webkit-tap-highlight-color: rgba(0, 0, 0, 0);

.menu__link:focus {
	outline: none;

We’ll use flexbox for the menu layout and define some common styles for the links.

The following is an effect style example (vendor prefixed properties omitted):

/* Prospero */

.menu--prospero .menu__link {
	position: relative;
	display: block;
	margin: 0 1.5em;
	padding: 0.75em 0;
	text-align: center;
	color: #b5b5b5;
	transition: color 0.3s;

.menu--prospero .menu__link:hover,
.menu--prospero .menu__link:focus {
	color: #929292;

.menu--prospero .menu__item--current .menu__link {
	color: #d94f5c;

.menu--prospero .menu__link::before {
	content: '';
	position: absolute;
	left: 0;
	bottom: 0;
	width: 100%;
	height: 4px;
	background: #d94f5c;
	transform: scale3d(0, 1, 1);
	transition: transform 0.1s;

.menu--prospero .menu__item--current .menu__link::before {
	transform: scale3d(1, 1, 1);
	transition-timing-function: cubic-bezier(0.4, 0, 0.2, 1);
	transition-duration: 0.3s;

In this effect we simply use a pseudo element line that starts to expand from the middle. It is positioned absolutely at the bottom of the link and initially scaled to 0 on the X. When we select a menu item by clicking on it, the line gets scaled to 1.

We hope you enjoy this little set and find it inspirational!

Don’t forget to fork the repo and add your styles if you like. Read more about it on the GitHub project page:

Tagged with:

Mary Lou

ML is a freelance web designer and developer with a passion for interaction design. She studied Cognitive Science and Computational Logic and has a weakness for the smell of freshly ground peppercorns.

Stay up to date with the latest web design and development news and relevant updates from Codrops.

CSS Reference

Learn about all important CSS properties from the basics with our extensive and easy-to-read CSS Reference.

It doesn't matter if you are a beginner or intermediate, start learning CSS now.

Feedback 52

Comments are closed.
  1. I create the same effect but that code is so much faster an better … thanks i gonna learn and use your code if is not a problem
    from brasil 😀

  2. Hi Ursula, I would be very happy if you could tell me about the javascript that you are using in order to have the link href working. Thanks a lot. Gunnar

  3. If you want to be able to use these nav bars and have the links working, may it be linked to an anchor link or external you’ll need to remove ev.preventDefault(); as this is what prevents a link from doing it’s default thing which is to follow the address.

    • just paste this to your js file (download jQuery library before):

      $(‘.menu__list li’).click(function(){

      Should work

  4. // Remove js code in demo and replace with this:

    $(‘a’).click(function (e) {
    e.preventDefault(); // prevent default anchor behavior
    var goTo = this.getAttribute(“href”); // store anchor href

    // do something while timeOut ticks …

    window.location = goTo;

    // this adds slight delay before going to hard link allowing the animation

    • I replaced the code in the demo with this and the animation is gone. By code in the demo, you mean the long function at the bottom under classie.js, right?

    • I figured it out. If you want the links to work and set a delay on them, use the following:

      (function() {
      []‘.menu’)).forEach(function(menu) {
      var menuItems = menu.querySelectorAll(‘.menu__link’),
      setCurrent = function(ev) {
      var goTo = this.getAttribute(‘href’);
      setTimeout(function() {
      window.location = goTo;
      var item =; // li

      // return if already current
      if (classie.has(item, ‘menu__item–current’)) {
      return false;
      // remove current
      classie.remove(menu.querySelector(‘.menu__item–current’), ‘menu__item–current’);
      // set current
      classie.add(item, ‘menu__item–current’);

      [] {
      el.addEventListener(‘click’, setCurrent);

      I’m not even sure why you need this part of the code:

      ]‘.link-copy’)).forEach(function(link) {
      link.setAttribute(‘data-clipboard-text’, location.protocol + ‘//’ + + location.pathname + ‘#’ +;
      new Clipboard(link);
      link.addEventListener(‘click’, function() {
      classie.add(link, ‘link-copy–animate’);
      setTimeout(function() {
      classie.remove(link, ‘link-copy–animate’);
      }, 300);

      Can someone explain that?

  5. Hello,

    Does anybody have an idea to reproduce the “Adrian” effect on an element that doesn’t have a fixed width ?

    Thank you very much for sharing this.

  6. This is just awesome…. I love the effect Valentine…. but I just wanted this effect to work on hover not on click,
    Please help me with this…
    Thanks a lot!!

  7. Hi-

    When I select a menu item, the boxed line around the menu option does not stay around the selected page. (example: I click the ABOUT Page from Home, the pink outline jumps back to the HOME link (instead of staying around the selected ABOUT page).

    This may be a problem only because I am a beginner. Any suggestions?? Love the menu! Thanks!!

    • Actually- I figured it out, so please disregard!!! It was obvious. Woops! Thanks

  8. Hello,

    anyone could help me with the Titania-Style, which dont get displayed correctly on mobile. When the window is smaller than 800px the borders are glitching around, tried viewport but seems that some mobiles still dont display it like the should do :S Thanks for your tips.

  9. Hi.

    I am trying to get “Juliet” working in one of my projects for a client, however I don’t know how to get it to play nicely with WordPress. Is there a WordPress friendly version, or any advise for a junior like me?

    Thanks in advance.

  10. Hello! Can I use these effects on mouse hover and not on active state? If yes can somebody point me in the right direction? Thanks!

  11. Hello,
    I’m trying to use the Valentine menu but the transitions don’t work out in external linking page would you kindly help out!
    I’m using it to create my portfolio.

  12. Is there any way to make any of these menu styles mobile responsive? Maybe a hamburger button when it’s viewed in mobile.

  13. Hello everyone! This effects are awesome, I’m using Valentine effect, can anyone tell me how can I make links work????? Thanks