My <div> is overlapping my drop-down tabs - html

I've been having a hard time on my website with my div tags... every time I hover over the arcade tab or other drop-down menu, it drops behind my div for my movies! I want this to be the opposite where the tabs overlay the divs. Any suggestions?
This is the CSS I've been using:
nav ul ul {
display: none;
}
nav ul li:hover > ul {
display: block;
}
nav ul {
background: #efefef;
background: linear-gradient(top, #D8D8D8 10%, #D0D0D0 90%);
background: -moz-linear-gradient(top, #D8D8D8 10%, #D0D0D0 90%);
background: -webkit-linear-gradient(top, #D8D8D8 10%, #D0D0D0 90%);
box-shadow: 0px 0px 9px 0px rgba(0,0,0,0.15);
padding: 0px 20px;
border-radius: 10px;
list-style: none;
position: relative;
display: inline-table;
}
nav ul:after {
content: ""; clear: both; display: block;
}
li {
float: left;
}
nav ul li:hover {
background: #4b545f;
background: linear-gradient(top, #4f5964 0%, #5f6975 40%);
background: -moz-linear-gradient(top, #4f5964 0%, #5f6975 40%);
background: -webkit-linear-gradient(top, #4f5964 0%,#5f6975 40%);
}
nav ul li:hover a {
color: #fff;
}
nav ul li a {
display: block; padding: 10px 40px;
color: #757575; text-decoration: none;
font-family:arial;
}
nav ul ul {
background: #5f6975; border-radius: 0px; padding: 0px;
position: absolute; top: 100%;
}
nav ul ul li {
float: none;
border-top: 1px solid #6b727c;
border-bottom: 1px solid #575f6a;
}
nav ul ul li a {
padding: 10px 40px;
color: #fff;
font-family:arial; font-weight:900;
}
nav ul ul li a:hover {
background: #4b545f;
}
nav ul ul ul {
position: absolute; left: 100%; top:0;
}
This is my HTML on the page for what it's overlapping:
<div id="text"><h1>Featured!</h1></div>
<div id="boxed">
<div id="movie">Ghost Shark</br><img src="/movies/posters/Ghost Shark.jpg"></div>
</div>
And this is the HTML for my nav pane:
<center><nav>
<ul>
<li>Home</li>
<li>Arcade
<ul>
<li>Action</li>
<li>Arcade</li>
<li>Puzzle</li>
<li>Vehicle</li>
<li>Violence</li>
<li>Defense</li>
<li>RPG</li>
</ul>
</li>
<li>Watch
<ul>
<li>TV Shows</li>
<li>Movies</li>
</ul>
</li>
<li>Extras
<ul>
<li>News</li>
<li>Updates</li>
</ul>
</li>
<li>Support</li>
</ul>
</nav></center>
The website it is on is http://gameshank.com/movies/horror/
Thanks is advanced!

Set a higher z-index to your nav
nav {
z-index: 1000;
}

Related

css horizontal menu with drop-down to vertical menu with drop-down

I would like to change a horizontal menu with a drop-down to a vertical menu with the drop-down items floating on the right or left, as well as all submenus. I am assuming this is an easy fix but I can figure it out. Thanks
Here is a working example of the horizontal working: http://codepen.io/anon/pen/RPMZJV
Here is the CSS:
body, div, h1, h2, h3, h4, h5, h6, p, ul, ol, li, dl, dt, dd, img, form, fieldset, input, textarea, blockquote {
margin: 0; padding: 0; border: 0;
}
body {
background: #909eab url(bg.png);
font-family: Helvetica, sans-serif; font-size: 18px; line-height: 24px;
}
nav {
margin: 100px auto;
text-align: center;
}
nav ul ul {
display: none;
}
nav ul li:hover > ul {
display: block;
}
nav ul {
background: #efefef;
background: linear-gradient(top, #efefef 0%, #bbbbbb 100%);
background: -moz-linear-gradient(top, #efefef 0%, #bbbbbb 100%);
background: -webkit-linear-gradient(top, #efefef 0%,#bbbbbb 100%);
box-shadow: 0px 0px 9px rgba(0,0,0,0.15);
padding: 0 20px;
border-radius: 10px;
list-style: none;
position: relative;
display: inline-table;
}
nav ul:after {
content: ""; clear: both; display: block;
}
nav ul li {
float: left;
}
nav ul li:hover {
background: #4b545f;
background: linear-gradient(top, #4f5964 0%, #5f6975 40%);
background: -moz-linear-gradient(top, #4f5964 0%, #5f6975 40%);
background: -webkit-linear-gradient(top, #4f5964 0%,#5f6975 40%);
}
nav ul li:hover a {
color: #fff;
}
nav ul li a {
display: block; padding: 25px 40px;
color: #757575; text-decoration: none;
}
nav ul ul {
background: #5f6975; border-radius: 0px; padding: 0;
position: absolute; top: 100%;
}
nav ul ul li {
float: none;
border-top: 1px solid #6b727c;
border-bottom: 1px solid #575f6a; position: relative;
}
nav ul ul li a {
padding: 15px 40px;
color: #fff;
}
nav ul ul li a:hover {
background: #4b545f;
}
nav ul ul ul {
position: absolute; left: 100%; top:0;
}
Here is the html:
<html>
<head>
<meta charset="utf-8" />
<title>CSS Dropdown Menu</title>
<link href="style.css" rel="stylesheet" />
</head>
<body>
<nav>
<ul>
<li>Home</li>
<li>Tutorials
<ul>
<li>Photoshop
<ul>
<li>HTML</li>
<li>CSS</li>
</ul>
</li>
<li>Illustrator</li>
<li>Web Design
<ul>
<li>HTML</li>
<li>CSS</li>
</ul>
</li>
</ul>
</li>
<li>Articles
<ul>
<li>Web Design</li>
<li>User Experience</li>
</ul>
</li>
<li>Inspiration</li>
</ul>
</nav>
</body>
</html>
If I understood correctly you'll want to remove your float: left from the list-items, set a fixed with for your nav and then change the positioning of the dropdowns to your desired position.
As mentioned in the comments, to get the submenus to align with the menu item the user hovers on, you will need to set it to position: relative so that the absolute positioning of the child element is relative to that of the ul > li element.
nav ul > li {
position: relative;
}
Updated Codepen
You need to remove the float of the list items and re-position the second level menu :
nav ul li {
/*float: left;*/ <<<< removing float left
}
....
Bbackground: -moz-linear-gradient(top, #4f5964 0%, #5f6975 40%);
background: -webkit-linear-gradient(top, #4f5964 0%,#5f6975 40%);
}
nav ul li:hover a {
color: #fff;
}
nav ul li a {
display: block; padding: 25px 40px;
color: #757575; text-decoration: none;
}
nav ul ul {
background: #5f6975; border-radius: 0px; padding: 0;
position: absolute; top: 30%;left:92%;//<<< setting new position for second ul
}
nav ul ul li {
float: none;
border-top: 1px solid #6b727c;
border-bottom: 1px solid #575f6a; position: relative;
}
nav ul ul li a {
padding: 15px 40px;
color: #fff;
}
nav ul ul li a:hover {
background: #4b545f;
}
nav ul ul ul {
position: absolute; left: 100%; top:0;
}

Drop down nav menu off when decreasing browser size

I'm working at making a responsive site and on this site I have a drop down menu. When I bring the size down to 900px I keep the menu, but it gets pressed all the way to the left side of my browser. I gave it a little left padding just so it would be off the wall till it hits 600px at which point it goes into a list-block view and I hide drop down box. Basically I need to find a way to keep the drop down menu between 600px and 900px so that it will still show up under the respective places they're supposed to. Including a screen shot to show what's happening.
Edit: I made a fiddle
And now my code
HTML5
<nav>
<nav class="nav-wrapper">
<ul>
<li>Home
</li>
<li>Appliances
</li>
<li>Electronics
<ul>
<li>Computers</li>
<li>Game Systems</li>
<li>Televisions</li>
</ul>
</li>
<li>Furniture
<ul>
<li>Bedroom</li>
<li>Dining Room</li>
<li>Living Room</li>
</ul>
</li>
<li>Location
</li>
</ul>
</nav>
</nav>
CSS3
/*Default CSS*/
.main-header nav ul ul {
display: none;
}
.main-header nav ul li:hover > ul {
display: block;
}
.main-header nav ul {
background: #efefef;
background: linear-gradient(top, #efefef 0%, #bbbbbb 100%);
background: -moz-linear-gradient(top, #efefef 0%, #bbbbbb 100%);
background: -webkit-linear-gradient(top, #efefef 0%, #bbbbbb 100%);
box-shadow: 0px 0px 9px rgba(0, 0, 0, 0.15);
padding: 0 20px;
border-radius: 10px;
list-style: none;
position: relative;
display: inline-table;
}
.main-header nav ul:after {
content:"";
clear: both;
display: block;
}
.main-header nav ul li {
float: left;
}
.main-header nav ul li:hover {
background: #4b545f;
background: linear-gradient(top, #4f5964 0%, #5f6975 40%);
background: -moz-linear-gradient(top, #4f5964 0%, #5f6975 40%);
background: -webkit-linear-gradient(top, #4f5964 0%, #5f6975 40%);
}
.main-header nav ul li:hover a {
color: #fff;
}
.main-header nav ul li a {
display: block;
padding: 25px 40px;
color: #757575;
text-decoration: none;
}
.main-header nav ul ul {
background: #5f6975;
border-radius: 0px;
padding: 0;
position: absolute;
top: 100%;
}
.main-header nav ul ul li {
float: none;
border-top: 1px solid #6b727c;
border-bottom: 1px solid #575f6a;
position: relative;
}
.main-header nav ul ul li a {
padding: 15px 40px;
color: #fff;
}
.main-header nav ul ul li a:hover {
background: #4b545f;
}
/*Between 600px and 900px*/
.main-header nav ul {
position: relative;
margin: 0 auto;
left: 10%;
}
.main-header nav ul ul {
position: absolute;
top: 100%;
}
As you can see I haven't messed with a lot of it, I think the work I need should be with just these two lines. If anyone can help me it would be much appreciated.
The absolute positioned dropdown needs to be inside of a relative positioned container
.main-header nav ul li {
float: left;
position: relative;
}
http://jsfiddle.net/UhEk4/2/
Obviously there are more work to be done to adjust the positions but you should be able to take it from here

How do I display menu items in front of images?

I have a horizontal navigation menu and when you hover over the menu, the items display behind the images on the webpage as opposed to in front of. How would I fix this?
CODE: http://jsfiddle.net/MvWkZ/
HTML:
<div id="nav">
<ul>
<li>Home</li>
<li>Tutorials
<ul>
<li>Photoshop</li>
<li>Illustrator</li>
<li>Web Design
<ul>
<li>HTML</li>
<li>CSS</li>
</ul>
</li>
</ul>
</li>
<li>Articles
<ul>
<li>Web Design</li>
<li>User Experience</li>
</ul>
</li>
<li>Inspiration</li>
</ul>
</div>
CSS:
#nav ul ul {
display: none;
}
#nav ul li:hover > ul {
display: block;
}
#nav ul {
background: #efefef;
background: linear-gradient(top, #efefef 0%, #bbbbbb 100%);
background: -moz-linear-gradient(top, #efefef 0%, #bbbbbb 100%);
background: -webkit-linear-gradient(top, #efefef 0%,#bbbbbb 100%);
box-shadow: 0px 0px 9px rgba(0,0,0,0.15);
padding: 0 20px;
border-radius: 10px;
list-style: none;
position: relative;
display: inline-table;
}
#nav ul:after {
content: ""; clear: both; display: block;
}
#nav ul li {
float: left;
}
#nav ul li:hover {
background: #4b545f;
background: linear-gradient(top, #4f5964 0%, #5f6975 40%);
background: -moz-linear-gradient(top, #4f5964 0%, #5f6975 40%);
background: -webkit-linear-gradient(top, #4f5964 0%,#5f6975 40%);
}
#nav ul li:hover a {
color: #fff;
}
#nav ul li a {
display: block; padding: 25px 40px;
color: #757575; text-decoration: none;
}
#nav ul ul {
background: #5f6975; border-radius: 0px; padding: 0;
position: absolute; top: 100%;
}
#nav ul ul li {
float: none;
border-top: 1px solid #6b727c;
border-bottom: 1px solid #575f6a;
position: relative;
}
#nav ul ul li a {
padding: 15px 40px;
color: #fff;
}
#nav ul ul li a:hover {
background: #4b545f;
}
#nav ul ul ul {
position: absolute; left: 100%; top:0;
}
You should try to use the z-index css attribute :
.horizontalmenu{
z-index:10; /*or more than your image */
position:relative;
}
Post some code if you want a more precise answer
Edit : As said by Don in comments, be sure to put your menu in position:relative (edited css)
Just set the z-index=1 (or any number that is higher than the images) for example in the css for the menu. Hope this helps :)

My tabs are not working as they should

I just finished writing my code for my navigation tabs using HTML5 and CSS3, but I'm having an issue! The tabs work perfectly in notepad, but when I put it in my website, it just doesn't work.
This is my CSS code:
nav ul ul {
display: none;
}
nav ul li:hover > ul {
display: block;
}
nav ul {
background: #efefef;
background: linear-gradient(top, #D8D8D8 10%, #D0D0D0 90%);
background: -moz-linear-gradient(top, #D8D8D8 10%, #D0D0D0 90%);
background: -webkit-linear-gradient(top, #D8D8D8 10%, #D0D0D0 90%);
box-shadow: 0px 0px 9px 0px rgba(0,0,0,0.15);
padding: 0px 20px;
border-radius: 10px;
list-style: none;
position: relative;
display: inline-table;
}
nav ul:after {
content: ""; clear: both; display: block;
}
li {
float: left;
}
nav ul li:hover {
background: #4b545f;
background: linear-gradient(top, #4f5964 0%, #5f6975 40%);
background: -moz-linear-gradient(top, #4f5964 0%, #5f6975 40%);
background: -webkit-linear-gradient(top, #4f5964 0%,#5f6975 40%);
}
nav ul li:hover a {
color: #fff;
}
nav ul li a {
display: block; padding: 10px 40px;
color: #757575; text-decoration: none;
font-family:arial;
}
nav ul ul {
background: #5f6975; border-radius: 0px; padding: 0px;
position: absolute; top: 100%;
}
nav ul ul li {
float: none;
border-top: 1px solid #6b727c;
border-bottom: 1px solid #575f6a;
position: relative;
}
nav ul ul li a {
padding: 10px 40px;
color: #fff;
font-family:arial; font-weight:900;
}
nav ul ul li a:hover {
background: #4b545f;
}
nav ul ul ul {
position: absolute; left: 100%; top:0;
}
The following is the HTML code I use to place them in the website:
<center><nav>
<ul>
<li>Home</li>
<li>Arcade
<ul>
<li>Action</li>
<li>Arcade</li>
<li>Puzzle</li>
<li>Vehicle</li>
<li>Violence</li>
<li>Defense</li>
<li>Point N Click</li>
<li>RPG</li>
</ul>
</li>
<li>Watch
<ul>
<li>TV Shows</li>
<li>Movies</li>
</ul>
</li>
<li>Extras
<ul>
<li>News</li>
<li>Updates</li>
</ul>
</li>
<li>Support</li>
</ul>
</nav></center>
If I delete the Home tab, the Arcade tab takes its place and looks the same way. Any ideas?
My website that this is happening on is: http://gameshank.com/8-20-13/
Thanks ahead!
On your site an additional link is inside your first li.
<a id="top"></a>
Also the center tag is deprecated. You should use:
margin: 0 auto;
For block level elements.

Add tooltip tail to a CSS dropdown menu?

I would like my dropdown menu to have a tooltip tail under each dropdown. The CSS dropdown tutorial was easy, but I can't figure out how to add the arrow. See jsfiddle
HTML
<nav>
<ul>
<li>Home</li>
<li>Tutorials
<ul>
<li>Photoshop</li>
<li>Illustrator</li>
<li>Web Design
<ul>
<li>HTML</li>
<li>CSS</li>
</ul>
</li>
</ul>
</li>
<li>Articles
<ul>
<li>Web Design</li>
<li>User Experience</li>
</ul>
</li>
<li>Inspiration</li>
</ul>
CSS
<style>
nav {
margin: 100px auto;
text-align: center;
}
nav ul ul {
display: none;
}
nav ul li:hover > ul {
display: block;
}
nav ul {
background: #efefef;
background: linear-gradient(top, #efefef 0%, #bbbbbb 100%);
background: -moz-linear-gradient(top, #efefef 0%, #bbbbbb 100%);
background: -webkit-linear-gradient(top, #efefef 0%,#bbbbbb 100%);
box-shadow: 0px 0px 9px rgba(0,0,0,0.15);
padding: 0 20px;
border-radius: 10px;
list-style: none;
position: relative;
display: inline-table;
}
nav ul:after {
content: ""; clear: both; display: block;
}
nav ul li {
float: left;
}
nav ul li:hover {
background: #4b545f;
background: linear-gradient(top, #4f5964 0%, #5f6975 40%);
background: -moz-linear-gradient(top, #4f5964 0%, #5f6975 40%);
background: -webkit-linear-gradient(top, #4f5964 0%,#5f6975 40%);
}
nav ul li:hover a {
color: #fff;
}
nav ul li a {
display: block; padding: 25px 40px;
color: #757575; text-decoration: none;
}
nav ul ul {
background: #5f6975; border-radius: 0px; padding: 0;
position: absolute; top: 100%;
}
nav ul ul li {
float: none;
border-top: 1px solid #6b727c;
border-bottom: 1px solid #575f6a; position: relative;
}
nav ul ul li a {
padding: 15px 40px;
color: #fff;
}
nav ul ul li a:hover {
background: #4b545f;
}
nav ul ul ul {
position: absolute; left: 100%; top:0;
}
</style>
That's usually accomplished by using something like the pseudo-selector :before, doing something like:
nav ul ul:before {
position: absolute;
top: -9px;
left:20px;
display: inline-block;
border-right: 9px solid transparent;
border-bottom: 9px solid #EEE;
border-left: 9px solid transparent;
content: '';
}
However keep in mind your hover and submenu color is the same, so you may want to style it a bit to suit your tastes...
Demo: http://jsfiddle.net/darkajax/vXdqu/
You can use the CSS pseudo-selector :before and borders:
http://jsfiddle.net/xFUun/2/