Drop down menu hidden behind background image - html

I have asked everyone I know, and I've searched this site too, but no luck. Now I'm asking all of you for help. I am using HTML5 and CSS3 to make my second website. (First one was 7 years ago, looks terrible now!)
My current roadblock: I created a drop down menu on one of the tabs on my Nav Bar, but it goes behind the background image and any other content on the page. I have tried using the z-index in every possible place (with a position marking) and I haven't had any luck.
Any ideas would be greatly appreciated! Thanks.
Here's the NavBar HTML Code:
<div id="nav">
<ul>
<li>Home</li>
<li>Bio</li>
<li>Gigs</li>
<li>Groups
<ul>
<li>SB Trio</li>
<li>NYGT</li>
<li>Qtto Bloomdido</li>
</ul>
</li>
<li>Publications</li>
<li>Repairs</li>
<li>Lessons</li>
<li>Contact</li>
</ul>
</div>
Here's the CSS from the NavBar:
#nav { position: relative;
top: 0;
text-align: center;
background-color: #FF9933;
background-image: url(images/WoodAfromosia.jpg);
font-family: "Comic Sans MS", Arial, Helvetica, sans-serif;
font-size: 130%;}
#nav ul { list-style: none;
padding: 1;
margin: 0% 0% 0% 0%;}
#nav ul li { float: center;
display:inline-block;
font-weight: bold;
text-transform: uppercase;}
#nav { overflow: hidden; width: 100%;}
#nav ul li a {display: inline-block;
padding: .5em;
background-color: peachpuff;
background-image: url(images/Paperpapyrus.jpg);
border: 2px solid #000;
border-radius: .5em;
margin: 3% 6% 3% 6%;
white-space:nowrap;}
#nav ul ul {display: none;}
#nav ul ul li {display: block;
float: left;
text-align: left;
margin: -6.5% 0% 0% -40% ;
width: 100px;}
#nav li:hover ul { position:absolute; /* Position under correct tab */
display:block;}
#nav li:hover li { float:none;
overflow: visible;}
#nav ul a:link { color: black; }
#nav ul a:visited { color: black; }
#nav ul a:focus { color: blue;
border-color: #fff; }
#nav ul a:hover { color: darkviolet;
border-color: #fff; }
#nav ul a:active {color: cyan; }
Here's the CSS from the Background Image and Intro Image just below the NavBar:
body { position: relative;
padding: 0;
margin: 0;
background-color: azure;
background-image: url(images/Paperwhitebricks.jpg);}
a {text-decoration: none;}
#intro {text-align: center;
margin: -1% 0% -.5% 0%;}

remove overflow:hidden from the #nav it will fix the issue
#nav {
overflow:hidden /* remove */
width: 100%;
}
here is the fiddle
JS Fiddle

Related

Dropdown menu links show on Focus

Can't seem to get the dropdown links to show (on focus) on when tabbing with the keyboard. Tried a couple different styles, but no luck. Any help would be appreciated.
body {
background: #005bbb;
font: 14px Sofia,Arial,sans-serif;
color: #444;
height: 100%;
line-height: 1;}
.nav-global a {text-decoration: none}
.nav-global ul li {
color: #005bbb;
float: left;
display: inline;
position: relative;
margin: 0;
width: 235px}
.nav-global ul li:hover {
background-color: #003e51;}
/* style the first level slightly different */
.nav-global > ul > li {
margin: 0;
width: auto;
background: #fff;
color: #005bbb}
.nav-global ul li a {
color: #005bbb;
padding: 12px 16px 14px 16px;
display: block;
font: 15px Sofia Bold, "Trebuchet MS", sans-serif;}
.nav-global ul li a:hover {
color: #fff}
.nav-global > ul > li > a {}
.nav-global li:hover > a {color: #fff}
/* ----------------------------------------------- secondary nav ----------------------------------------------- */
.nav-global ul li ul {
position: absolute;
max-height: 0;
overflow: hidden;
margin: 0;
opacity: 0;}
.nav-global ul li:hover > ul {
max-height: 1000px;
overflow: visible;
opacity: 1;}
.nav-global ul li ul li {
background-color: #003e51;}
.nav-global ul li ul li a {
color: #fff;
font: 13px Sofia, "Trebuchet MS", sans-serif;
padding: 0;
line-height: 30px;
text-indent: 15px;}
.nav-global ul li ul li a:hover {
background: #002935;}
.nav-global ul li ul li:first-child {
padding-top: 10px}
.nav-global ul li ul li:last-child {
padding-bottom: 10px}
.
<div class="nav-main">
<nav class="nav-global">
<ul>
<li>Find Materials
<ul>
<li>Everything</li>
<li>Catalog</li>
<li>Databases</li>
<li>E-Books</li>
<li>E-Journals</li>
<li>Course Reserve</li>
<li>Off Campus Access</li>
</ul>
</li>
</ul>
</nav>
</div>
=
I tried using the code like this for "on focus", but not working:
.nav-global ul li:focus > ul {
max-height: 1000px;
overflow: visible;
opacity: 1;}
Add tabindex="0" to nav-global and the :focus selector will work. In the code snippet below I apply this change and also add all sub-menu links to the tabindex order. Refer to this technique for WCAG 2.0.
Please note that once you open the menu with the tab key, your next tab will close the menu since nav-global looses focus, as indicated in a comment to your question. If the mouse is hovering over the menu, it will remain open, and you can type TAB to see how each link in the tabindex receives focus.
I would suggest controlling menu visibility with javascript so you don't rely on css to maintain its state. Js can give you more control over the user experience. For instance, adding a keyhandler to close the menu when ESC is typed.
Here's the code:
body {
background: #005bbb;
font: 14px Sofia, Arial, sans-serif;
color: #444;
height: 100%;
line-height: 1;
}
.nav-global a {
text-decoration: none
}
.nav-global ul li {
color: #005bbb;
float: left;
display: inline;
position: relative;
margin: 0;
width: 235px
}
.nav-global ul li:hover {
background-color: #003e51;
}
/* style the first level slightly different */
.nav-global>ul>li {
margin: 0;
width: auto;
background: #fff;
color: #005bbb
}
.nav-global ul li a {
color: #005bbb;
padding: 12px 16px 14px 16px;
display: block;
font: 15px Sofia Bold, "Trebuchet MS", sans-serif;
}
.nav-global ul li a:hover {
color: #fff
}
.nav-global>ul>li>a {}
.nav-global li:hover>a {
color: #fff
}
/* ----------------------------------------------- secondary nav ----------------------------------------------- */
.nav-global:focus>ul>li>ul {
max-height: 1000px;
overflow: visible;
opacity: 1;
}
.nav-global>ul>li:focus>ul {
max-height: 1000px;
overflow: visible;
opacity: 1;
}
.nav-global:focus>ul>li {
background-color: #003e51;
}
.nav-global:focus>ul>li>a {
color: white;
}
.nav-global ul li ul {
position: absolute;
max-height: 0;
overflow: hidden;
margin: 0;
opacity: 0;
}
.nav-global ul li:hover>ul {
max-height: 1000px;
overflow: visible;
opacity: 1;
}
.nav-global ul li ul li {
background-color: #003e51;
}
.nav-global ul li ul li a {
color: #fff;
font: 13px Sofia, "Trebuchet MS", sans-serif;
padding: 0;
line-height: 30px;
text-indent: 15px;
}
.nav-global ul li ul li a:hover {
background: #002935;
}
.nav-global ul li ul li:first-child {
padding-top: 10px
}
.nav-global ul li ul li:last-child {
padding-bottom: 10px
}
.
<div class="nav-main">
<nav class="nav-global" tabindex="0">
<ul>
<li>
Find Materials
<ul>
<li>Everything</li>
<li>Catalog</li>
<li>Databases</li>
<li>E-Books</li>
<li>E-Journals</li>
<li>Course Reserve</li>
<li>Off Campus Access</li>
</ul>
</li>
</ul>
</nav>
</div>

CSS Dropdown menu [HELP]

Hello i have problem with the drop-down menu link to the menu when you hover product the drop-down menu is weird and i struggle can you please help ?
thank you
The HTML:
<div class="nav">
<ul>
<li class="home">Home</li>
<li class="faq">Products
<ul>
<li>TEST</li>
<li>TEST</li>
<li>TEST</li>
</ul>
</li>
<li class="service">Pricing</li>
<li class="contact">Contact</li>
<li class="logout">Logout</li>
</ul>
</div>
The CSS:
body {margin: 0;
padding: 0;
background: #ccc;}
.nav ul {list-style: none;
background-color: #1dde1d;
text-align: center;
padding: 0;
margin: 0;}
.nav li {font-family: 'Oswald', sans-serif;
font-size: 1.2em;
line-height: 40px;
height: 40px;
border-bottom: 1px solid #888;}
.nav a {text-decoration: none;
color: #fff;
display: block;
transition: .3s background-color;}
.nav a:hover {background-color: #23c823;}
.nav ul li ul li {display: none;}
.nav ul li:hover ul li{display: block;}
#media screen and (min-width: 600px) {
.nav li {width: 120px;
border-bottom: none;
height: 50px;
line-height: 50px;
font-size: 1.4em;}
#container {min-height:100%;
position:relative;}
.footerWrap {width:100%;
position:fixed;
bottom: 0px;}
.footer {width:200px;
margin:auto;}
.footerContent {float:left;
width:100%;
background-color:#009900;
padding:1px 0;}
.footer p {float:left;
width:100%;
text-align:center;}
/* Option 1 - Display Inline */
.nav li {display: inline-block;
margin-right: -4px;}
}
Remove height: 40px; from .nav li and add position: relative; to .nav ul it works well.
.nav ul {
list-style: none;
background-color: #1dde1d;
text-align: center;
padding: 0;
margin: 0;
position: relative; //added position.
}
Check Your updated Fiddle here.
At a sheer guess based on the limited info in the question... try this CSS:
.nav ul li {position:relative;}
.nav ul li ul {position:absolute;top:100%;}

What am I missing in making a dropdown nav?

As stated above, what am I not seeing in my coding (html and CSS) to make a standard list dropdown in my nav?
When I go to preview this portion of the page in Chrome and IE the nav section looks fine until I hover over my Fishing and Guides link. It hides the other selections when it's supposed to display the main sections along with different subsections within a particular subject.
Do I also need to incorporate jquery to make this work?
#topnav {
background-color: #333333;
clear: both;
border-bottom: 3px #cccccc solid;
overflow: hidden;
}
#topnav ul {
width: 100%;
float: left;
margin: 0px;
background-color: #333333;
position: relative;
}
#topnav ul li {
display: inline
}
#topnav ul li a {
float: left;
padding: 10px 20px;
color: white;
text-decoration: none;
}
#topnav a:visited {
color: #ffffff;
}
#topnav a:active {
color: #ffffff;
}
#topnav a:hover {
color: #ffffff;
background-color: maroon;
}
#topnav a:focus {
color: #ffffff;
}
#topnav ul li img {
vertical-align: middle;
padding-left: 8px;
width: 22px;
height: 18px;
}
#topnav ul li:hover ul {
display: block;
}
#topnav ul ul {
display: none;
position: absolute;
background-color: #333333;
border: 5px #333333 solid;
border-top: 0px;
margin-left: -5px;
min-width: 100px;
}
#topnav ul ul li {
display: block
}
#topnav ul ul li a:visited {
color: #ffffff;
}
#topnav ul ul li a:hover {
color: #ffffff;
background-color: maroon;
}
#topnav ul ul li a:focus {
color: #ffffff;
}
<div id="topnav">
<ul>
<li> Home
</li>
<li>
Fishing & Guides<img src="Images/bearpawwhitenav.png"/>
<ul>
<li>Fishing Tips
</li>
</ul>
</li>
<li>
Accommodations
</li>
<li>
Area & History
</li>
<li>
Rates
</li>
<li>
Contact
</li>
</ul>
</div>
When you :hover fishing guides you are showing fishing tips. The fishing tips is hiding the rest of your nav, it's sitting ontop. You should position it so it appears below the main nav. Carl is right, bootstrap is great resource for building these types of things.

keeping parent nav background active when on child page - CSS Weebly

I'm trying to keep the parent nav background active when on child page.
Example: Portfolio---->Programs
When my current page is Programs, I'd like to keep the Portfolio active on the navigation bar.
The code use in the CSS is:
/* Navigation
--------------------------------------------------------------------------------*/
#nav-wrap {
max-height: 200px;
}
#nav .container ul {
list-style: none !important;
}
#nav .container ul li {
list-style: none !important;
}
#nav .container ul span:last-child li,
#nav .container ul > li:last-child {
/*background: none;*/
background:url(surf_40.gif) no-repeat -12px;
}
#nav ul li a {
display: block;
font-size:30px;
line-height: 35px;
padding: 10px 0;
color: rgba(255,255,255,0.4);
padding: 2px 25px 2px 21px;
border: 0;
outline: 0;
list-style-type: none;
position:relative;
right:-4px;
z-index:1;
text-transform: uppercase;
font-family: 'Aller', sans-serif;
}
#nav ul li#active a {
background: url(surf_40.gif) no-repeat -12px;
}
#nav ul li#active a,
#nav ul li a:hover {
color: #fff;
border: 0;
}
/**Text modified added - for active parent while my current page is a sub-menu***/
#wsite-menus .wsite-menu li #active a #nav ul li a {
color: #fff;
border: 0;
}
/*---*/
/* Navigation Submenu's
--------------------------------------------------------------------------------*/
#wsite-menus .wsite-menu li a {
color: rgba(0,0,0,0.4);
font-weight: bold;
background: #fff;
/*border: 0 px;*/
border: solid thick;
border-radius: 1em;
/* fine modifica*/
position:relative;
right: 0 px;
}
#wsite-menus .wsite-menu li a:hover {
color: #000;
background: #e3e3e3;
border: solid thick orange;
}
thank you for any help..
HTML code:
<div id="nav">
<ul class='wsite-menu-default'>
<li id='pg962547086691527768'><a href="/" data-membership-required="0" >Home</a></li>
<li id='pg623326219140352077'><a href="/about.html" data-membership-required="0">About</a</li>
</ul></div>
Put the :hover on li's instead of a:hover and alos add class active to li. if you provide html two then i will provide you the perfect solution thanks

Drop down menu button isn't coloured fully and there are strange gaps in between

I'm trying to fix my drop down menu but I'm having problems with the highlighted colour and the background colour/size.
When I hover it, it is not covering the full button with orange like I want it to and, it has some grey left in it from the background where I don't want it to be.
One of the issues may be the fact I'm using 2 style sheets for mobile and computer.
HTML:
<div id="nav">
<ul id="menu">
<li id="active">Home</li>
<li>About Revelstoke</li>
<li>Ticker Rates</li>
<li>Snow School
<ul id="sub-menu">
<li>Kids Lessons</li>
<li>Adult Lessons</li>
<li>First Tracks</li>
</ul>
</li>
<li>Weather</li>
<li>Gallery</li>
<li>Trail Maps</li>
<li>Contact Us</li>
</ul>
</div><!--close nav-->
CSS (computer):
#nav {
background-color:#eee;
height: 33px;
border-top: solid black 2px;
border-bottom: solid black 2px;
min-width: 1000px;
}
#nav #active a {
font-weight: bold;
color: #ffffff;
background-color: #0160a2;
padding: 5px 15px 8px 15px;
}
#nav ul {
text-align: left;
font-size: 18px;
background-color: #eee;
}
#nav ul li {
display: block;
position: relative;
float: left;
line-height: 24px;
}
#nav ul li a {
display:inline;
padding:5px 10px 8px 10px;
background-color: #eee;
}
#nav li ul {
display: none;
}
#nav li:hover ul {
display: block;
position: absolute;
margin-top: 6px;
padding: 0;
width: 97px;
height: 82px;
}
#nav li:hover li {
font-size: 14px;
}
#nav ul li a:hover {
background-color: #ff8a00;
color: #000000;
}
#nav ul li ul li a{
padding:5px;
}
#nav ul li ul li a:hover{
padding:5px;
width: 97px;
height: 82px;
}
CSS (mobile):
#nav {
background-color:#eee;
}
#nav ul {
text-align:center;
font-size: 18px;
}
#nav ul li {
list-style-type:none;
border-top: 3px solid white;
}
#nav ul li a {
color: #000000;
display:block;
padding:13px 0;
text-decoration:none;
font-weight: bold;
}
#nav ul li a:hover {
background-color: #0096ff;
font-weight: bold;
color: white;
}
#nav #active a {
background-color: #01385e;
font-weight: bold;
color: white;
}
If I understood your question this should be a solution http://jsfiddle.net/GcDGv/2/ (I worked only for non-mobile CSS), this is how I fixed it:
I removed all height properties from classes related to the sub-menu. They can be auto-calculated.
Change the width of li elements in sub-menu to 100%, so now they will use whole area.
Make links in sub-menu as block elements, so margin/paddings from top and bottom will work as you want. And removed width and height properties from last style ul li ul li a:hover