Skip to content
View in the app

A better way to browse. Learn more.

Web Designer Forum

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

CSS SPRITE + DROP DOWN MENU

Featured Replies

Hi . I have successfully learnt to create a CSS sprite Image based navigation menu.But now I need to create a drop down menu for one main menu option(something like this http://www.nandos.co.uk/). I see codes which use jquery and creating child ul inside li's but I am not clear how it works.

 

 

CSS

 

ul#menu{
width:980x;
list-style:none;
float:left;
}
ul#menu li { display: inline; }
ul#menu li a {
display:block; 
overflow:hidden;
height:76px;
float:left;
background-image:url('images/mainmenu.jpg'); 
text-indent: -9999px;
}
ul#menu li a.home {
	width: 173px; background-position: 0 0;	
}
	ul#menu li a.gallery{
	width: 210px; background-position: -173px 0;	
}
ul#menu li a.menu {
	width: 231px; background-position: -383px 0;	
}
ul#menu li a.location {
	width: 223px; background-position: -614px 0;	
}
ul#menu li a.blog{
	width: 143px; background-position: -837px 0;	
}
	ul#menu li a.home:hover, ul#menu li a.home:focus {
	background-position: 0 -76px;	
}
ul#menu li a.gallery:hover, ul#menu li a.gallery:focus {
	background-position: -173px -76px;	
}
	ul#menu li a.menu:hover, ul#menu li a.menu:focus {
	background-position: -383px -76px;	
}

ul#menu li a.location:hover, ul#menu li a.location:focus {
	background-position: -614px -76px;	
}

ul#menu li a.blog:hover, ul#menu li a.blog:focus {
	background-position: -837px -76px;	
}

 

html

 

 

<div id="nav"> 
       <ul id="menu">
       <li><a href="index.html" class="home" >home</a></li>
       <li><a href="gallery.html" class="gallery" >gallery</a>
           <ul>
           <li><a href="#">Branch1</a></li>
           <li><a href="#">Branch2</a></li>
           </ul></li>

       <li><a href="main_menu.html" class="menu">menu</a></li>
       <li><a href="location.html" class="location">location</a></li>
       <li><a href="blog.html" class="blog">uc</a></li>
       </ul>
       </div>

So far this is my code and I am stuck totally.. Thanks for your help in advance !

Edited by Renaissance-Design
Please use the code button or tags to format your code.

Create an account or sign in to comment

Account

Navigation

Search

Search

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.