Please, enter a valid email!
00 days
00 hours
00 minutes
00 seconds

Color-Coded Dropdown Navigation with Submenus

Dropdown menus have been around for years and they've served their purpose quite well. Very much like old-yet-functional technology, dropdown menus continue to support users from all browsers and operating systems. The major differences have come about from a change in newer trends with jQuery and CSS3. I recently found a great example on the Tuts+ website and decided to recreate a similar menu structure.

Making Your Website Responsive. What Are Your Options? [Free Ebook]

Zemez Responsive Navbar JavaScript

Zemez Responsive Navbar JavaScript.

Demo | Download

Web design is constantly evolving, and every day there are more and more new developments in this area. But this does not mean that you can forget about the site's navigation structure. Without proper navigation, your website will not work effectively. Thanks to the responsive Navbar JavaScript, you do not need to think about writing a script on your own to improve the navigation on your web resource. Let’s check why this script is worth attention.

Zemez states that Navbar JavaScript is fully responsive and highly customizable, so you are welcome to apply any edits to make an absolutely unique resource. Moreover, the package includes 8 beautiful layouts to choose the most suitable one for your project. 24/7 support and detailed documentation are included for your convenience.

More features:

  • Dark and light color schemes
  • Flexbox-based
  • Fixed and fullwidth layouts
  • Sticky navbar
  • SASS

In this tutorial I want to demonstrate how you can build a multi-tier dropdown menu with jQuery. The most basic solution is to create a menu with one dropdown list. But it's possible to nest two or even three menus into a list to create sub-menu flyouts. I'll be using color-coded menu links following Tuts+ to replicate a similar interface. Take a peek at my sample demo to get an idea of the final product.

Live Demo - Download Source Code

Getting Started

Creating the menu is primarily within the domain of CSS but the dropdown effect is created using jQuery. It is possible to build this entirely in CSS but only modern browsers would support that functionality. I've chosen jQuery because it's more efficient and universally supported.

<!doctype html>
  Color-Coded Dropdown Nav Menu - Template Monster Demo

Grab a local copy of the jQuery library and include this in the document header. Also create a separate stylesheet named styles.css which will contain all the page structure and menu design.

For the page itself I've created an outer wrapper using the ID #wrapper. Inside is an unordered list with the ID #menu. This main menu container holds all the primary links, most of which also contain sub-menus. The "categories" link includes a sub-sub-menu which holds sub-categories. This is what the HTML structure looks like:

Each of the internal category links have an additional class name. This is how we can setup unique colors which take over the link and sub-menu while the user is hovering. It's all very straightforward and each nested UL element is contained within a parent list item.

Designing with CSS

At the top of my stylesheet you'll notice a large block of page resets. These remove default browser settings like margin/padding and font sizes to create a uniform blank slate.

Below the resets I've setup a primary page structure for the main elements. An outer nav element spans the entirety of the page using a dark blue background. Inside is the #wrapper div which centers content and holds the main navigation.

/** page structure **/
nav {
  display: block;
  width: 100%;
  height: 70px;
  background: #384958;

.wrapper { 
  display: block;
  margin: 0 auto;
  width: 750px;

#menu {
  display: block;
  position: relative;
  z-index: 99;

In the top-tier menu we have all the main links which are displayed at all times. Each anchor link is a block-level element so it takes up more space for users to hover. Notice the 2nd tier menu has a z-index property of -1. This will ensure that the dropdown appears beneath the main blue navbar to hide excessive padding or drop shadows.

These 2nd tier menus are targeted as #menu li ul because they're the 2nd ul element. I'm using absolute positioning so they'll fit relative to the parent list item while keeping the z-index property in check. Now we get into the 3rd tier menu which is a flyout display of extra categories.

#menu li {
  display: block;
  float: left;
#menu li a {
  display: block;
  position: relative;
  float: left;
  padding: 0 35px;
  font-size: 1.5em;
  line-height: 70px;
  font-weight: bold;
  text-decoration: none;
  color: #f5f5f5;
#menu li a:hover, #menu li {
  background: #fff;
  color: #2c343b;

#menu li ul {
  display: none;
  position: absolute;
  top: 70px;
  width: 200px;
  background: #fff;
  z-index: -1;
  -webkit-box-shadow: 0 2px 7px rgba(0,0,0,0.45);
  -moz-box-shadow: 0 2px 7px rgba(0,0,0,0.45);
  box-shadow: 0 2px 7px rgba(0,0,0,0.45);
#menu li ul li {
  display: block;
  width: 200px;
#menu li ul li a {
  display: block;
  float: none;
  color: #4e5b67;
  font-size: 1.35em;
  line-height: 50px;
  padding: 0 15px;
#menu li ul li a:hover {
  background: #384958;
  color: #fff;

These appear as the 3rd ul element in the navigation. You'll notice that I'm actually targeting the 2nd tier UL with an additional class of .expanded. This is because of the drop shadow effect which needs to appear like one big block - so instead of creating 2 different menus I'm just making the dropdown menu wider. This gives the illusion of a flyout menu which is connected to the original dropdown.

#menu li ul.expanded {
  width: 400px;
#menu li ul.expanded li { margin-right: 200px; }

#menu li ul li ul {
  display: none;
  position: absolute;
  left: 200px;
  top: 0;
  height: 100%;
  background: none;
  -webkit-box-shadow: none;
  -moz-box-shadow: none;
  box-shadow: none;
#menu li ul li ul li a { color: #fff; }
#menu li ul li ul li a:hover { text-decoration: underline; }

#menu li ul li.purple a:hover, #menu li ul li.purple { background: #4f4c83; color: #fff; }
#menu li ul li.purple ul { background: #4f4c83; }

#menu li ul a:hover, #menu li ul { background: #65834c; color: #fff; }
#menu li ul ul { background: #65834c; }

#menu li ul li.aqua a:hover, #menu li ul li.aqua { background: #4c7983; color: #fff; }
#menu li ul li.aqua ul { background: #4c7983; color: #fff; }

#menu li ul a:hover, #menu li ul { background: #834c4c; color: #fff; }
#menu li ul ul { background: #834c4c; }

#menu li ul a:hover, #menu li ul { background: #4d6899; color: #fff; }
#menu li ul ul { background: #4d6899; }

#menu li ul a:hover, #menu li ul { background: #97944c; color: #fff; }
#menu li ul ul { background: #97944c; }

Absolute positioning is also used for the 3rd tier menu which is fixed at the very top of the nav container. This means it will always be directly parallel with the original dropdown so it just looks like one large menu.

Also the parent list item can take one of several classes like .purple, .green, or .aqua. You can also create your own color class by mimicking the same template with a different background color.

Dropdown Menus with jQuery

Finally we get to the pièce de résistance of this beautiful navigation that makes the whole thing sparkle. We only need a couple event handlers related to the 2nd tier and 3rd tier menus. But first I should clarify a small block of code located at the very start of my JavaScript:

$('a[href="#"]').on('click', function(e){

This selector matches every anchor link using the href="#" attribute. A link using the hash symbol leads nowhere and is generally meant for wireframing or demos like my example. But when a user clicks the hash symbol it gets loaded into the browser window - kind of annoying and not really useful.

This block of jQuery stops that from happening. It's not necessary to keep this block of code if you remove all the blank links but it does come in handy when building small demo pages.

$('#menu > li').on('mouseover', function(e){
  $(this).find('> a').addClass('active');
}).on('mouseout', function(e){
  $(this).find('> a').removeClass('active');

First up is the original dropdown menu. When a user hovers any list item contained within #menu we display the very first sub-menu list. This is selected through ul:first which is a CSS pseudo-class targeting the first child. The hovered link also gets a class of .active to keep it highlighted even if the user moves their mouse down onto links in the dropdown menu.

During a mouseout event the menu will hide and the parent anchor link is no longer active. We'll find a very similar approach used for the sub-sub menu but with a little more detail.

$('#menu li li').on('mouseover',function(e){
  if($(this).has('ul').length) {
  $('ul:first',this).parent().find('> a').addClass('active');
  $('ul:first',this).parent().find('> a').removeClass('active');
  $('ul:first', this).hide();

One immediate change you'll notice is the logic check for $(this).has('ul').length. In plain English this says "if the hovered link has another sub-menu then do something". What we do is add an .expanded class onto the parent list so we get that wider flyout menu effect.

Then everything else follows the same pattern by adding the .active class onto the parent link and displaying the sub-sub-menu. In reverse during a mouseout event the .expanded and .active classes are removed while hiding the sub-sub-menu.

When you see a jQuery selector like $('ul:first',this) it's taking 2 parameters. Normally we only pass one parameter which is the target, but the 2nd parameter is the domain(also known as context). For the mouseover/mouseout event this refers to the sub-menu list item. So within the domain of a list item we want to target the very first child(the sub-sub-menu). Following this same logic we could even build a 4th-tier menu if needed.


Unlike other navigation with sub-menus this tutorial creates dropdown menus within even measurement. Each flyout menu appears in the same location connected to the parent link by a common color scheme. This may not be an effect that works for every website but it's certainly unique and still provides an exceptional user experience. Feel free to download a copy of my source code and just go nuts with it. I mean don't literally go insane, but yeah the code is free so have fun!

Jake Rocheleau

First it was design, then writing, and now affiliate marketing. Over a period of 6-7 years he wrote a lot of content for many websites. You can reach Jake on Twitter.

Get more to your email

Subscribe to our newsletter and access exclusive content and offers available only to MonsterPost subscribers.

From was successfully send!
Server error. Please, try again later.

101 responses to “Color-Coded Dropdown Navigation with Submenus”

  1. Poltergeisha says:

    turksel tarifesi

  2. Audry says:

    Highly energetic post, I enjoyed that a lot. Will there be a part 2?|

  3. Stephani says:

    Do you have a spam problem on this site; I also am a blogger, and I was curious about your situation; we have developed some nice procedures and we are looking to swap strategies with other folks, be sure to shoot me an e-mail if interested.|

  4. August says:

    Fascinating blog! Is your theme custom made or did you download it from somewhere? A theme like yours with a few simple tweeks would really make my blog jump out. Please let me know where you got your theme. Bless you|

  5. Pignorant says:

    Thank you for an informative post.…</a

  6. darıca hayvanat bahcesi

  7. Bahis siteleri güvenilir: Bu ve buna benzer favorisen Tahminleri Spor Toto Tahminleri yayınlandı. Sitede tıpkı spor bahisleri sektörü giderek büyüyor. Çünkü bahis şirketleri ile ilgili bulgular alınabilir, üyelik işlemleri de en büyük otellerinden biri olan Betpastan bahis alabilirsiniz. Kaçak bahis sitelerine para yatirma ve binlerce bahissevere bu bonuslar ile elde edilen kazançlara ortak olmak çok basit olmaktadır. Bu sitelerin tamamı meşru ve lisanslı olarak etkinlik göstermektedir. Sitenin ana sayfası ile çok seçenek sunmuş durumdalar. Bu kuponların çoğunluğunun tutuyor olması üyelerin günlük olarak yayınlanan bonus veren bahis ve casino oyunlarında yalnızca bir kere hesaba para yatırmak ve çekmek de bunun adı şanssızlıktır. Diğer yandan, her biri değişik avantajlara sahip olan ve bahisleri hızlı, basit ve süratli kullanım olanağı bulunmaktadır. 25 Avrupa Kupaları Yatırım Bonusu: Sitenin sunmuş bulunduğu etkin hizmetini çevrimiçi ortama giriş yapmış bir platformdur. deneme bonusu

  8. Yasal bahis: Bildiğiniz gibi yerli bahis müdavimlerinin en çok aktif üyeye sahip bahis ve casino sitesi kesintisiz bir şekilde yükselmesi ile beraber kullanıcılar akıllı telefon ile de yeni oldukları amacıyla bu yatırım cepbank üzerinden yapılmalıdır. Bu hali en aza indirebilirsiniz. Hem de sarfedilen üyelikler amacıyla de bir grup farklılıklar gösterebiliyor. Yapmış olduğunuz sanal kart teknolojisi olarak karşımıza çıkan finansal problemler, adaxbet söz hususu olduğunda para çekme zamanı 1 saat içersinde 20 TL değerindeki yatırımlarda, yatırımın yapılmasının sonrasında, prosedür yapılmadan evvel Canlı Destek ekibine bağlantı kurarak talep etmeniz gerekir. Çünkü bonus vasıtası ile bahis oynamak amacıyla bu alanda ne kadar şuana kadar iyi performans gösterdi. Site sayılarının yükselmesine paralel olarak mühim bir katkıda bulundu. Dilediğiniz para yatırma işleminize 100 oranında 500 TL Bedava Bonus500 TL hoşgeldin bonusu var. Genellikle internet teknolojisi ile beraber kendinizi güvende hissedeceğiniz bir marka olarak da TRY Turkish Lira seçeneklerini işaretlemek gerekiyor. Fakat doğrultu bahisleri mi yoksa doğrultu bahisleri biraz riskli olsa da uygun görünüyor.

  9. gobahis says:

    Birçok sitede, müşteriler canlı sohbet personelinden daha çok bilgiye sahiptir ve problemleri çözemezler. gobahis Canlı destek personeli bilgili, çözüm odaklı, sabırlı ve kibar olmalıdır. Canlı desteğin yanı sıra değişik yöntemler kullanılarak firma ile etkileşim kurulabilmelidir. Bu çerçevede hizmet e-posta, telefon ya da whatsapp destek hattı ile sağlanabilir. Bu yöntemlerden rastgele birini kullanan bir müşteri, işlemleri süratli bir şekilde yönetebilmelidir.

  10. Exxenbet sosyal medya hesaplarını takip ederek hemen bütün bilgilerden haberdar olabilir ve bütün içeriklerine itimat edilir şekilde ulaşabilirsiniz. Sosyal medyanın yanısıra aynı vakitte sms, mail, whatsapp hattı, telegram ve canlı destek hattı üzerinden bahis sitesi ile rahatlıkla iletişime geçebileceksiniz. En aktif etkileşim tekniği canlı destek hattıdır. Canlı destek hattı sitenin ana sayfasında yer almakta ve kullanıcılarına hemen geri dönüş yapmaktadır. 7 gün 24 saat hizmet yayınlayan Exxenbet , kullanıcılarına süratli geri dönüşler yaparak bütün problem ve şikayetleriniz ile ilgilenmektedir. Canlı destek dendiğinde akla gelen üyelere vermiş bulunduğu destek gelmektedir. Site içinde yaşamış olduğunuz bütün sorun, şikayet, tavsiye ve dileklerinizi canlı destek hattına bildirerek ayrıntılı hizmet alabilirsiniz. Para yatırım, para çekim, oyun seçenekleri, bonus ve kampanyalar, Vıp ve güncel adres bilgi kapasitesi gibi çoğu bahis içeriği ile ilgili ayrıntılı bilgi alabilirsiniz. Kullancılarının memnuniyetini odlukça önemseyen Exxenbet, üyelerinin problemsiz bahis hizmeti alabilmeleri amacıyla günün her zamanında ekibi ile sıkı çalışmaktadır.

  11. Bahis oynarken yapmış olduğunuz bakiye yüklemesinin yanı sıra bahis siteleri doğrulusunda sunulan bonusların detaylılığı de ehemmiyet taşımaktadır. Şimdilik ilk defa bahis yapar iken elde edeceğiniz promosyon fırsatlarını tam anlamıyla kullanarak bahis tadını üst civarlara çıkarabilirsiniz. Şuan fazlası bahis sitesinde tespit edilen deneme bonusu ise yeni kullanıcıların dikkatini bir hayli çekmekte. Hem bahis firmaları hemde oyuncular doğrulusunda cazip bir bonus türü olan deneme bonusu bir başka ismiyle yeni üye olanlara verilen bir nevi test hedefli bonus ismidir. Şimdi ayrıntılı olarak deneme bonusu nedir bunu inceleyelim aynı vakitte deneme bonusu veren siteler ile ilgili kapsamlı bulgular sunalım.

  12. Hedgehawk says:

    Way cool! Some extremely valid points! I appreciate you writing this post and also the rest of the website is extremely good .

  13. Thanks you nice post bro.

  14. drill man says:

    You are invited to my blog that I created and manageblog

  15. fda approved botox bladder

  16. botox injection bladder cpt code

  17. is getting bladder botox paintful

  18. upper helix piercing

  19. ear piercing frisco tx

  20. how long does it take to lose belly fat without exercise

  21. botox says:

    botox botox near me botox before and after

  22. botox says:

    botox botox near me botox before and after

  23. Is there any harm to the baby from having Botox while pregnant

  24. instagram high quality featured download program

  25. instagram quality post download site

  26. android instagram post download

  27. android image download instagram

  28. ios quality instagram profile picture download

  29. can you drink after botox

  30. can you drink after botox

  31. instagram high quality igtv download program

  32. mac instagram reels download free

  33. download video on instagram phone

  34. instagram tablet reels download

  35. instagram android online video download

  36. download instagram video

  37. αποθήκευση εικόνας στο instagram

  38. macbook insta profiilikuvan lataus

  39. DORT says:

    Wonderful concerns totally, you may gotten a whole new target audience. Quantity people recommend in regards to your own placed that you just built some days ago? Any confident?

  40. Homepage says:

    … [Trackback]

    […] Informations on that Topic: […]