A universal symbol for “menu” has been on a lot of people’s minds lately. (“Navicon”, get it?!). Jordan Moore wrote up a big article on it for Smashing Magazine. Jeremy Keith wrote about it. Stuart Robson wrote about it. Tim Kadlec wrote about it. If you want to read more about the thinking behind this stuff and see examples, read those.
In this article, I’m going to focus on the “three-line” symbol (as opposed to down arrows or other possible navicons). I quite like the three-line symbol as a symbol to represent menus. If we have to pick one, I’m all for this one.
We’re going to look at the “how” to create this symbol in a bunch of different ways.

Use an Image
How have we put symbols onto websites for… ever? Images. There is nothing wrong with this. This image is so simple it begs for SVG. SVG means it’s 1) super small file size and 2) can scale to any size crisply. The HTML would probably be:
<a href="#menu">
<img src="menu.svg" alt="">
Menu
</a>
If you are going to use the symbol unaccompanied by text, make sure to include the alt
text. You could use a PNG or whatever also, but SVG is perfect for this kind of simple drawing.
Use a Pseudo Element
There is nothing wrong with using an element, but if we use a pseudo-element and some trickery, we could make this symbol without the extra HTTP request that an image requires. (Yeah, it could be in your sprite, but you know what I mean).
Pseudo box-shadow
Nothing but semantic markup:
<a href="#menu" class="box-shadow-menu">
Menu
</a>
In CSS, make some space on the left of the link with some padding-left
. Set the positioning context with relative positioning. Then make a single black line absolutely positioned into that space on the top left. Then using box-shadow
, make two more lines beneath it.
.box-shadow-menu {
position: relative;
padding-left: 1.25em;
}
.box-shadow-menu:before {
content: "";
position: absolute;
left: 0;
top: 0.25em;
width: 1em;
height: 0.15em;
background: black;
box-shadow:
0 0.25em 0 0 black,
0 0.5em 0 0 black;
}
Pseudo gradient
Same markup as the one above. The same idea of creating a space for the pseudo-element to go. Only this time, use gradients to create the three lines. Remember gradients don’t actually need to fade color from one to another if you use “hard stops” where the color changes to another instantly at the same color-stop.
.gradient-menu {
padding-left: 1.25em;
position: relative;
}
.gradient-menu:before {
content: "";
position: absolute;
left: 0;
top: 0.21em;
bottom: 0.21em;
width: 1em;
background: linear-gradient(
to bottom,
black, black 20%,
white 20%, white 40%,
black 40%, black 60%,
white 60%, white 80%,
black 80%, black 100%
);
}
Pseudo border
Credit to Mr. Robson on this one. He created it by applying a double and a single solid border to the pseudo-element. He also used pixel values in his demo. Tim Kadlec converted them to ems so they scale with text which is nice.
.border-menu {
position: relative;
padding-left: 1.25em;
}
.border-menu:before {
content: "";
position: absolute;
top: 0.25em;
left: 0;
width: 1em;
height: 0.125em;
border-top: 0.375em double #000;
border-bottom: 0.125em solid #000;
}
Use Fonts
There is a unicode symbol with three lines in it.
<a href="#menu">
☰ Menu
</a>
You would think that would be perfect, but in reality, it ends up quite blurry. Looks OK on my retina display but pretty bad on non-retina. This kind of thing should be as crisp as can be anywhere.
You could always use an icon font as well. Entypo has this symbol in their free set. The lines are rounded, which looks good to me. Pictos has one with dot-line dot-line dot-line which is also good.
I haven’t had too much trouble with icon fonts being blurry like that Unicode icon is. I have no clue why that it, but c’est la vie.
Update: reader G S writes in:
Regarding the article https://css-tricks.com/three-line-menu-navicon/, an older Nokia phone with Opera 12 is able to display the unicode character for ‘IDENTICAL TO’ (U+2261), but not the TRIGRAM FOR HEAVEN’ (U+2630).
It would seem that a mathematical operator is more likely to be implemented in fonts than an iChing symbol.
Which is best?
I’d probably avoid the Unicode symbol as it doesn’t have the correct semantic meaning. I’d probably avoid making an HTTP request for an image just for this. The gradient thing is nice, but it’s a good size chunk of code to maintain.
I’d probably go for inline SVG.
“I quite the three line symbol”
“You would think that would be prefect”
Minor errors
Thanks! Fixed. I’m gonna buy just because it’s irrelevant now.
‘bury’ ;)
Rabble rabble!
El unicode es genial!
I put through Google Translate and:
I normally agree, but as you can see above: blurrytown.
I don’t see anything blurry about the unicode version (latest stable Chrome and FF on Win7). Chris, can you take a screenshot of exactly what you see when you say it’s blurry?
The only thing I do notice about the unicode version is that it looks much different on FF (more vertical space between lines) compared to Chrome, whereas the other versions look pretty much the same on both.
@Louis –
Small: http://cl.ly/K461
Big: http://cl.ly/K3ty
Both blurry to me.
I agree with Louis, the unicode version looks just fine on Windows 7.
Chris, I took a look at both in Opera, Firefox, Chrome, and Safari (all up-to-date and on Mac – Snow Leopard) and the Unicode versions do come out blurry. Maybe Windows has a ‘crisper’ Unicode set or renders differently than Mac (insert joke here).
Ok… it looks like anti-aliasing to me, because it’s not just lines, but actually a text character. I pretty much see the same thing on mine, but it just didn’t bother me. But yes, the other versions are definitely crisper. When you said “blurry” I was imagining some big fog. :)
Would be interesting if HTML/CSS had a way to say “don’t anti-alias this” (or is it cleartype?) or whatever.
For what it’s worth I’m on a Mac and the Unicode one looks crispy as can be.
Must be a combination of factors.
Late but still worth noting. The blur can be fixed by using
text-rendering: geometricPrecision;
on the unicode element.Just curious if there’d be a problem with building it out using block elements styled in css. the markup would be a little cumbersome, but the end result would be responsive, and you’d be able to use transitions on it in interesting ways.
… let’s try that again
<a href=”#” class=”menu”>
<span class=”horizLine”></span>
<span class=”horizLine”></span>
<span class=”horizLine”></span>
<span class=”hide”>Open Menu</span>
</a>
Christopher,
You have just created three unnecessary elements would you could accomplish the same with one element.
I realize that, Aaron, but wouldn’t the ends justify the means in this case? The result would be as flexible as an SVG without relying on browser support or additional assets (like modernizr, or a symbol font). It’d depend on only a couple CSS rules, and load as fast as any other block element on the page.
Perfect. I was just lookin’ how to implement this icon !
There is also this unicode charactere “identical to” ≡, a bit tiny.
I think I’ll try the pseudo element because I’m not using an icon font for now on my current project.
Anyway, as usual : Thanks Chris !
As Jordan Moore points out in his SmashingMag article, the ☰ unicode character does not render properly on Android devices. He mentions ≡ as an alternative choice with better device support, but that doesn’t really look right. Another meh.
I find the Bootstrap solution kind of interesting. It uses a sprite three times; once for each line!
Dang. The < pre > tags were working in the preview :(
Visit http://twitter.github.com/bootstrap/examples/hero.html and shrink your browser to below 760px if you want to see it.
Chrome’s latest build replaces the wrench with this three line icon. Personally I prefer the wrench as the three lines reminds me of a vent cover.
Exactly; speed holes. They make the browser faster.
Also I’m pretty sure that the original intention of the icon was for ‘Sorting’, I might have made that up though.
As a menu icon it works for though, really it’s about familiarity and pervasiveness – and I think this icon is already there.
Hmm, on Firefox your .svg is blurry and the unicode is crisp. That’s just me…
I did some experimenting with Unicode for this sort of thing, and a lot of mobile browsers are gonna have a hard time with it—Android (2.2–3.0) and Blackberry (5–7), in particular, if memory serves. They’ll either get a blank space or a “broken” character, like a rectangle or somesuch.
I love the idea of a universal menu item. One thing that I keep thinking about, though, is the use of this type of icon for reordering list items as well. You know, the drag n’ drop to reorder things. What do you guys think. Should we use something else for reorder functionality, or should we rethink the menu icon?
I honestly thought of this same thing. I love this icon and users are getting the hang of it meaning menu, so what do we now do with reordering do we give them something like the the movable cursor icon to signify that it can be reordered?
I think the dotted square (I have no example in my mind right now) you see sometimes can be the reorder icon.
If you’re using SVG, why not save the bandwidth and include the markup directly.
Menu
You’d only need to load a PNG for the crusties.
My thought exactly! That’s much easier than another http request for the same data.
With the exception of the width and height being explicitly defined, it seems in theory a worthwhile alternative.
@Chris I agree with you that the Unicode one looks blurry compared to the Pseudo Element one when viewing on Mac 10.8.2 and FF 15.0.1
I’d say probably a good 97% of people still don’t recognize the icon’s meaning, and it’s going to take quite some time for it to catch on.
At this stage it’s probably a good idea to have it alongside the word ‘menu’, putting it on its own will just confuse people.
Where does 97% come from? Is there a study or is that just made up?
Remember: Facebook and Google Chrome use it unaccompanied by text. Pretty big players there to risk users not understanding now to navigate the app.
Hooray for made-up statistics!
I’m not sure why an icon would confuse people? To me the concept of an icon without text is simple – I’d rather be unsure as to what the icon represents the first time I press it and then, upon immediately discovering it’s purpose, be happy I don’t have text there for the remaining billion times I push said icon. Lack of a label almost unintentionally implies that one can ‘figure it out’, instead of ‘we are going to label this icon indefinitely because you cannot learn’.
Remember icons are for sighted users… don’t forget about 12% of WORKING-Age individuals who are disabled… (poor eyesight, color-perception impairment, physical ailment such as Carpal Tunnel Syndrome, cognitive impairment, and etc.) Note: this is from actual studies if you need the sources please let me know…
But even not considering disabled people we need text for other reasons you may not have considered: For example, someone might use a screen reader in their car to read out navigation directions or a flight itinerary while driving so they can keep their eyes on the road.
I think as technologies improve and converge, the more we develop with accessibilities the more we get a competitive edge in the near future. Remember accessibility means anyone and anything can access the information… that means any OS, any browser, any technology and any person regardless their abilities.
That’s a very interesting discussion, I think that each method can be a good solution from case to case.
For example, a while ago I used a base64 string for my responsive CSS3 dropdown here. Assuming that my three line menu navicon will be visible only for certain media queries, older browsers would be excluded (because they don’t support media queries) so I thought using this method is appropriate.
Now, considering the retina displays, my solution doesn’t sound so good anymore :)
Latest Chrome on XP shows a box on unicode – the broken character Mat mentions above. Fine in other browsers.
I don’t get it. After failing to rebuild the gradient method I have copied the code from codepen and I dont get the black lines. Anyone else with the sam issue?
-solved. Better check prefixr -.-‘ thanks again chris
That’s great, but you just made a “list view” icon.
Funny, but again, HUGE apps and sites are using this to represent menus, so mind-saturation of what this icon means is happening as we speak. What it means to you as a developer or someone who has preconceived notions of what this three line thing means is less important that what it means to a user looking at it.
I’ve seen it, too, but all it did in my case was confuse me and hide what the control was supposed to do. I think gears and wrenches and whatnot are slightly more indicative of such menus, but even they are far from ideal, as they require a pretty big metaphorical leap. Regardless of how huge a company Google is, I still think it’s a bit of a boneheaded pick — but hey, maybe they did a study that showed people remembered the visual concept of menus (a list of text items) better than the idea of what menus let them do.
I think it’s easy to see the difference between a list view icon and a menu icon in this case.
List views are usually accompanied by other icons to represent the different states like: grid view.
Also list icons usually have an extra dot or block in front of each of the lines to show it like a bulleted list.
3 things.
Excellent post.
Unicode is blurry for me on win 7 in all browsers…
To argue that it isn’t recognized as the “Menu” button is effing ludicrous. Factual information and logical deduction clearly point to it as damn near the standard for a menu icon….
While the fact that there is unicode that will work for it; you should absolutely NOT be using Unicode to represent this symbol.
It’s the definition of a hack. CSS or SVG/IMG are a better way. Using the Chinese Trigram ☰ (Heaven) should be heavily discouraged.
The box-shadow and gradient are the crispiest chips in the bag. They also work like a charm at various sizes. I’m 110% sure on this decision.
Three lines are here to stay. Soon we’ll be able to scribe the magical three lines into rock so others may understand our mystical interface iconography.
Interesting read, even if, as you said, tons of peaople already talked about it. It’s always interesting to have your point of view! :-)
I think too that wee need a standard icon for navigation menus and this seems like an appropriate one. People using Facebook (mobile) are used to it and since it’s probably one of the most used mobile App, it’s fair to assume that it became a standard. And for people not knowing it, a simple tap of curiosity will do the trick for the first time they see it.
I’m not shocked by the use of an image. I’m not a big fan of using “hacks” to have a result that simple images like this can do.
If this is the only image you have on your site, it’s probably worth finding another option. If not, it’s a small icon that you can easily add to your sprites.
Personally I’m quite fond of the icon Microsoft use on their home page:
I had a play around and came up with an approximation using CSS pseudo-elements.
Ah it ate my image. Here’s a link to it instead.
Both look nearly same. I didn’t see any blur in my windows 8 pc with chrome but ie10 is useless. It blurs everything even the text is blurred, crap ie. If osx was available for common pc windows would have died long ago and (gates in the gate for g4 security)
Someone mentioned that this “menu icon” looks alot like what is often used for a “list view” icon. Should we still be using the same icon for “list view” then?
If you intend on using a lot of smaller icons on your website then I would consider using “font awesome” which has this, and many other very handy symbols included for free.
I think the SVG Version is the most fexible. You can change the Image / Vector to any other Icon when the Mobile Developement thinks that another Icon is more right then the three Bars.
Its a good way to bring Vectors instead of static Images to Websites as well. I think we will see that a lot in the future when we got newer displays and higher resolutions.
I CSS this icon a while ago but as a mobile drag handle, I used background-size instead ;)
http://codepen.io/seanjacob/pen/pBDmK
div:before { content:''; position:absolute; top:0.25em; left:0; width:1em; height:0.75em; background-image:-webkit-linear-gradient(top, black 30%, transparent 30%); background-size:100% 0.3em; }
Even though the three lines navicon looks like a grab handle for sortable lists (like on iOS etc) I still think its a great little icon for menus too.
Google seem to be using it everywhere, back buttons, menu buttons, more info buttons, anything that navigates to a page with listed data.
Keep in mind that images can be very restrictive with regards to skinning. If that’s something that matters for your site, be sure to take that into consideration and use one of the other techniques Chris mentions or (if your tech requirements allow), use the SVG directly in your CSS.
Another version using single borders, padding, and content-box background-clip:
Three Line Menu Navicon for Modern and Legacy Browsers
http://codepen.io/anon/full/Lxecv
‘love it
This article was great, but when I tried the pseudo box-shadow and pseudo gradient methods, only the top of the three lines became an active link. Justin, your method is so much cleaner AND makes all three lines into an active link. Thank you!
I will try to implement this in bootstrap. :)
To tie it all together a little bit more, I’ve written a post on the three lines navicon and my thoughts on it’s usage here
http://alwaystwisted.com/post.php?s=2012-10-12-these-3-lines
aaawh google jumps on the bandwagon. Google mobile got the sidemenu like the facebook app!
Retina screen here. Unicode looks fine to me large but the middle line blurry on the small size. My assumption is that it’s using a .5 pixel on something which makes the opacity on the 1px 50% so you get a semi blurry image. Not sure but that’s what my brain told me.
There’s also a html code equiv, instead of whipping out the unicode cavalry.
What about the symbol for heaven/sky (Qián) in the eight diagrams used in Taoist cosmology?
It has a different unicode value. It works fine for me.
Will that make any difference to ☰ (☰) that you are using in your example?
Easy solutions are always the best ! I’ll try it ona ma blog.
This is the easiest and probably the best solution. Thanks
The heaven/sky character looks different depending on the browser, with some lines fatter than others.
The equiv character seemed great until I tried Opera Mobile/Mini.
I’m using bold pipe characters ||| and
-webkit-transform:rotate(-90deg);-moz-transform:rotate(-90deg);-ms-transform:rotate(-90deg);-o-transform:rotate(-90deg);
For different line lengths/thicknesses, try lowercase L lll or capital i III and different sans-serif fonts
I coined the term “navicon” in 1998 and nobody paid attention. Good to see it catching on now.
probably the best solution, The demo graphic was very helpful too. Thanks
The unicode smoothing issue can be fixed with -webkit-font-smoothing:none – however this only works in relatively recent versions of webkit browsers.
You are an endless source of inspiration and super helpful tricks! Thanks and thanks again :)
You can also use the unicode math operator
≡
. The major difference is the height/width ratio of the two unicode characters.Text is going to antialias unless you instruct otherwise.
Considering 99.99999% of the rest of the UI is antialiased by default I wouldn’t be too concerned about the “blurriness” of a single unicode character. That’s silly talk.
btw, the unicode is 8801
Hello,
The does not work on (Mac) Safari.
Must add -webkit- to the style
background: -webkit-linear-gradient(top, ….
And it is ok :-)
Great post as usual Chris!
You could also have combination of pseudo elements and on a nav element and avoid extra markup and requests.
I put together the following pen to illustrate:
Hmmmmh
Interesting subject but I find it odd that this discussion about a universal symbol for menu is taking place whilst as far as I am aware we have no international symbol for indicating language choice.
Websites that for one reason or another do not have a URL per language are stuck using flags or risking the fact that attention span deficient users will not search for EN FR DE etc – most savvy website designers realise that only flags will get attention in time – the requirement I feel is an eyecatching symbol not unlike a flag followed by the ISO language codes but the symbol is necessary the codes on their own will not work in the real world.
I do think to some degree the language blindness of the US has something to do with this.
Here it has another solution, it’s a page, but if you remove the border, that’s a 4 lines menu
http://cssdeck.com/labs/css3-monochrome-icon-set
Is it ok on all your devices ?
another way:
http://www.sitekickr.com/blog/creating-navicon-icon/
Pro tip: If you’re going to use it, use ≡ not &9776; or
ࣕ has wider support across browsers.
http://unicode.johnholtripley.co.uk/2261/
However, few users are familiar with the pattern, and the “Menu” label on a button tests much more successfully.
http://exisweb.net/menu-eats-hamburger
Oop. The form rendered it. It’s U+2261. Not 9776 or 2630.
Button with SVG:
At first I struggled with the button/hyperlink cause the SVG doesn’t allow any click events, realised I was missing this in my css for the svg icon {pointer-events: none;}.
works like a charm now!
The
text-rendering: optimizeLegibility;
fixes the Unicode problem.I just thought of using 3 old school
<hr>
tags in a button. not to bad if you ask me.Another fun alternative I’ve come up with (and used for animation effects):
Oops – looks like Funkyscript had the idea too! https://css-tricks.com/three-line-menu-navicon/#comment-196713
http://uxfindings.blogspot.com: There is such a hype about this three line mobile menu concept. There is however a bit of research that has revealed that the design of the hamburger icon can lead users to believe that it is actually a drag bar. I’d like to submit the idea that maybe we need some Nanointeraction Design here. Maybe it’s time for a new menu icon…
A New Menu Icon
http://uxfindings.blogspot.com/2014/06/a-new-menu-icon.html
Why searching for new design? A minus sign on first line and 2 ‘large minus’ signs (em dash) on line 2 and 3 looks like a menu, it can be made very easily with characters on all OS. May be 4th line can be added, must see the ‘requirements’