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.

Responsive drop down menu

Featured Replies

Hi,

 

I've got to a point with this project where I'm beginning to pull my hair out.

 

The problem I have is I've styled what I think is a good drop down menu based on tutorials etc online.

 

Everything looks as I want and works fine on a desktop. But when you try and use the drop down menu on a touch screen device, the menu doesn't stay down - you can't select another page.

 

Can anyone advise please. The project is here - http://www.clearstreamdesign.co.uk/chesters2014/

 

Thanks.

Repeating what Jack said, a hover-activated mobile menu makes literally no sense, as hovering doesn't exist on mobile/tablet. Your mobile menu is also quite uncomfortable to use in a desktop browser too, actually. I'd keep it simple - make it clickable.

please every one I'm just a newbie to webdesign and was trying to get myself with CSS drop down menu but my problem now is that i' m having issues with some lines of the solution I got. I will post after this message.

.menu {

border :none ;

border :0px ;

margin :0px ;

padding :0px ;

font: 67.5 % "Lucida Sans Unicode" , "Bitstream Vera Sans" , "Trebuchet Unicode MS", "Lucida

font- size: 14px;

font- weight :bold ;

}

.menu ul{

background:#F93;

height :50px ;

list- style :none ;

margin :0;

padding :0;

-webkit -border - radius : 15px ;

-moz- border -radius : 15px;

border -radius : 15px;

-webkit -box -shadow : inset 0px 16px 0px 0px rgba (255 , 255 , 255 , .1 );

-moz- box-shadow : inset 0px 16px 0px 0px rgba( 255, 255, 255, .1);

box-shadow : inset 0px 16px 0px 0px rgba( 255, 255, 255, .1);

}

.menu li{

float :left ;

padding :0px 0px 0px 15px;

}

.menu li a {

color :#000;

display :block ;

font- weight :normal ;

line- height :50px ;

margin :0px ;

padding :0px 25px ;

text- align :center ;

text- decoration:none ;

}

.menu li a :hover {

background:#C60;

color :#FFFFFF;

text- decoration:none ;

-webkit -box -shadow : inset 0px 0px 7px 2px rgba (0, 0, 0, .3);

-moz- box-shadow : inset 0px 0px 7px 2px rgba (0 , 0, 0, .3 );

box-shadow : inset 0px 0px 7px 2px rgba (0 , 0, 0, .3 );

}

.menu ul li :hover a{

background:#C60;

color :#FFFFFF;

text- decoration:none ;

}

.menu li ul {

display :none ;

height :auto ;

padding :0px ;

margin :0px ;

border :0px ;

position:absolute;

width :200px ;

z-index :200 ;

}

.menu li:hover ul{

display :block ;

}

.menu li li {

display :block ;

float :none ;

margin :0px ;

padding :0px ;

width :200px ;

background:#F93;

/*this is where the rounded corners for the dropdown disappears*/

}

.menu li:hover li a{

background:none ;

}

.menu li ul a{

display :block ;

height :50px ;

font- size: 12px;

font- style :normal ;

margin :0px ;

padding :0px 10px 0px 15px ;

text- align :left ;

}

.menu li ul a:hover , .menu li ul li :hover a{

border :0px ;

color :#ffffff;

text- decoration:none ;

background:#C60;

-webkit -box -shadow : inset 0px 0px 7px 2px rgba (0, 0, 0, .3);

-moz- box-shadow : inset 0px 0px 7px 2px rgba (0 , 0, 0, .3 );

box-shadow : inset 0px 0px 7px 2px rgba (0 , 0, 0, .3 );

}

this is are the lines that I'm having issues below

 

webkit -border - radius : 15px ;

-moz- border -radius : 15px;

border -radius : 15px;

-webkit -box- shadow : inset 0px 16px 0px 0px rgba (255, 255, 255, .1);

-moz- box-shadow : inset 0px 16px 0px 0px rgba( 255, 255, 255, .1);

box-shadow : inset 0px 16px 0px 0px rgba( 255, 255, 255, .1);

}

 

. ........,..........................................................................

use this code...

 

-webkit-border-radius : 15px ;
-moz-border-radius : 15px;
border-radius : 15px;
-webkit-box-shadow : inset 0px 16px 0px 0px rgba (255 , 255 , 255 , .1 );
-moz-box-shadow : inset 0px 16px 0px 0px rgba( 255, 255, 255, .1);
box-shadow : inset 0px 16px 0px 0px rgba( 255, 255, 255, .1);

jerseydudek - Have you tried aria haspopup? This means that when you touch a drop down menu, the drop down items stay visible allowing you to touch the drop down item you require, otherwise the drop down items disappear as you move your finger over them to select the item you want.

 

http://www.w3.org/TR/wai-aria/states_and_properties#aria-haspopup

msdn.microsoft.com/en-gb/library/ie/jj152135(v=vs.85).aspx

 

example here: http://stackoverflow.com/questions/3474099/what-is-html5-aria

Edited by Wickham

You should use javascript to toggle the dropdown menu on click for touch screens. Or you can have no dropdown on the touch screens but the main link would take you to a landing page that lists the other sub-pages.

 

EDIT

 

just checked your link. Why not go with a toggle option to open the menu on tablets, like others have said don't use a hover state. You need javascript for the click event.

A common icon for this toggling of the main navigation is a box with a list of 3 lines inside, commonly referred to as a burger icon.

Edited by rbrtsmith

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.