I want to center vertical the text of the ListItem Home, About, FAQ and Kontakt.
All 4 ListItems should be a bit lower
I use
nav {
font-family: Helvetica, Arial, sans-serif;
font-size: 18px;
/*line-height: 24px;*/
text-align: center;
margin-top: 20px;
float: right;
}
nav ul ul {
display: none;
margin: 0px;
}
nav ul li:hover > ul {
display: block;
}
nav ul {
background: #FFC400;
background: -webkit-linear-gradient(top, #e05f03 0%, #ca5603 100%);
background: -moz-linear-gradient(top, #e05f03 0%, #ca5603 100%);
background: -o-linear-gradient(top, #e05f03 0%, #ca5603 100%);
background: -ms-linear-gradient(top, #e05f03 0%, #ca5603 100%);
background: linear-gradient(top, #e05f03 0%, #ca5603 100%);
box-shadow: 0px 0px 9px rgba(0, 0, 0, 0.15);
padding: 0 10px;
border-radius: 10px;
list-style: none;
position: relative;
display: inline-table;
}
nav ul:after {
content: "";
clear: both;
display: block;
}
nav ul li {
float: left;
width: 150px;
height: 60px;
}
nav ul li:hover {
background: #4b545f;
background: -moz-linear-gradient(top, #FFC400 0%, #FFA600 100%);
background: -o-linear-gradient(top, #FFC400 0%, #FFA600 100%);
background: -ms-linear-gradient(top, #FFC400 0%, #FFA600 100%);
background: linear-gradient(top, #FFC400 0%, #FFA600 100%);
}
nav ul li:hover a {
color: #fff;
text-decoration: none;
}
nav ul li a {
display: block;
padding: 10px 10px;
color: white;
text-decoration: none;
}
nav ul ul {
/*background: #5f6975;*/
border-radius: 0px;
padding: 0;
position: absolute;
top: 100%;
}
nav ul ul li {
float: none;
width: 120px;
position: relative;
}
nav ul ul li a {
padding: 15px 20px;
color: #fff;
}
nav ul ul li a:hover {
background: #4b545f;
}
<nav>
<ul>
<li>Home
</li>
<li>
Large word need 2 lines
<ul>
<li>Photoshop
</li>
<li>Illustrator
</li>
<li>Illustrator
</li>
<li>Illustrator
</li>
<li>Illustrator
</li>
<li>Illustrator
</li>
</ul>
</li>
<li>
About
<ul>
<li>Web Design
</li>
<li>User Experience
</li>
</ul>
</li>
<li>FAQ
</li>
<li>Kontakt
</li>
</ul>
</nav>
Try it
nav ul li {
float: left;
width: 150px;
height: 60px;
line-height:40px;
vertical-align:middle;
}
Try to take advantage of flexbox:
https://jsfiddle.net/2nd64LtL/
The li items become flex containers and get display:flex and flex-direction: column;, the included a elements get margin: auto, which centers them vertically along the flex-axis:
nav ul li {
float: left;
width: 150px;
height: 60px;
display:flex;
flex-direction: column;
}
nav ul li a {
padding: 10px 10px;
color: white;
text-decoration: none;
margin: auto;
}
Removed float and height styles from nav ul li, selectors > added to target immediate children and not effect submenu items.
nav > ul > li {
width: 150px;
vertical-align: middle;
display: inline-block;
}
nav {
font-family: Helvetica, Arial, sans-serif;
font-size: 18px;
/*line-height: 24px;*/
text-align: center;
margin-top: 20px;
float: right;
}
nav ul ul {
display: none;
margin: 0px;
}
nav ul li:hover > ul {
display: block;
}
nav ul {
background: #FFC400;
background: -webkit-linear-gradient(top, #e05f03 0%, #ca5603 100%);
background: -moz-linear-gradient(top, #e05f03 0%, #ca5603 100%);
background: -o-linear-gradient(top, #e05f03 0%, #ca5603 100%);
background: -ms-linear-gradient(top, #e05f03 0%, #ca5603 100%);
background: linear-gradient(top, #e05f03 0%, #ca5603 100%);
box-shadow: 0px 0px 9px rgba(0, 0, 0, 0.15);
padding: 0 10px;
border-radius: 10px;
list-style: none;
position: relative;
display: inline-table;
}
nav ul:after {
content: "";
clear: both;
display: block;
}
nav ul li {
width: 150px;
vertical-align: middle;
display: inline-block;
}
nav ul li:hover {
background: #4b545f;
background: -moz-linear-gradient(top, #FFC400 0%, #FFA600 100%);
background: -o-linear-gradient(top, #FFC400 0%, #FFA600 100%);
background: -ms-linear-gradient(top, #FFC400 0%, #FFA600 100%);
background: linear-gradient(top, #FFC400 0%, #FFA600 100%);
}
nav ul li:hover a {
color: #fff;
text-decoration: none;
}
nav ul li a {
display: block;
padding: 10px 10px;
color: white;
text-decoration: none;
}
nav ul ul {
/*background: #5f6975;*/
border-radius: 0px;
padding: 0;
position: absolute;
top: 100%;
}
nav ul ul li {
float: none;
width: 120px;
position: relative;
}
nav ul ul li a {
padding: 15px 20px;
color: #fff;
}
nav ul ul li a:hover {
background: #4b545f;
}
<nav>
<ul>
<li>Home
</li>
<li>
Large word need 2 lines
<ul>
<li>Photoshop
</li>
<li>Illustrator
</li>
<li>Illustrator
</li>
<li>Illustrator
</li>
<li>Illustrator
</li>
<li>Illustrator
</li>
</ul>
</li>
<li>
About
<ul>
<li>Web Design
</li>
<li>User Experience
</li>
</ul>
</li>
<li>FAQ
</li>
<li>Kontakt
</li>
</ul>
</nav>
https://jsfiddle.net/v2opnsqt/6/
Related
I have a navigation tab which is only taking up half of the width which I require, I need it to take up 100% width however it does not. I have looked at around this site and google could not get it working like I want it. IThe navigation ie the black background should take up 100% of the width however it does not. any ideas.
nav ul ul {
display: none;
}
nav ul li:hover > ul {
display: block;
}
nav ul {
background: #1e1d1d;
background: linear-gradient(top, #1e1d1d 0%, #bbbbbb 100%);
background: -moz-linear-gradient(top, #1e1d1d 0%, #bbbbbb 100%);
background: -webkit-linear-gradient(top, #1e1d1d 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: #f7f7f7;
background: linear-gradient(top, #f7f7f7 0%, #5f6975 40%);
background: -moz-linear-gradient(top, #f7f7f7 0%, #5f6975 40%);
background: -webkit-linear-gradient(top, #f7f7f7 0%,#5f6975 40%);
}
nav ul li:hover a {
color: #ff0000;
}
nav ul li a {
display: block; padding: 25px 40px;
color: #f7f7f7; text-decoration: none;
}
nav ul ul {
background: #f7f7f7; border-radius: 0px; padding: 0;
position: absolute; top: 100%;
}
nav ul ul li {
float: none;
position: relative;
}
nav ul ul li a {
padding: 15px 40px;
}
nav ul ul li a:hover {
background: #888484;
color: #ff0000;
}
nav ul ul ul {
position: absolute; left: 100%; top:0;
}
<nav>
<ul>
<li>Basin & Sinks</li>
<li>Showers
<ul>
<li>Shower Trays</li>
<li>Shower Glass
<ul>
<li>Frosted</li>
<li>Clear</li>
</ul>
</li>
</ul>
</li>
<li>Bathroom Accessories
<ul>
<li>Plugs</li>
<li>Toilet Paper</li>
</ul>
</li>
<li>Toilets</li>
</ul>
</nav>
https://jsfiddle.net/1nzot5rq/1/
have tried several links and have tried width: 100%, max-width: 100%; however I have had no luck.
Just add width: 100%; box-sizing: border-box; to nav ul like this: https://jsfiddle.net/d8ch5qer/
nav ul ul {
display: none;
}
nav ul li:hover > ul {
display: block;
}
nav ul {
background: #1e1d1d;
background: linear-gradient(top, #1e1d1d 0%, #bbbbbb 100%);
background: -moz-linear-gradient(top, #1e1d1d 0%, #bbbbbb 100%);
background: -webkit-linear-gradient(top, #1e1d1d 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;
width: 100%;
box-sizing: border-box;
}
nav ul:after {
content: "";
clear: both;
display: block;
}
nav ul li {
float: left;
}
nav ul li:hover {
background: #f7f7f7;
background: linear-gradient(top, #f7f7f7 0%, #5f6975 40%);
background: -moz-linear-gradient(top, #f7f7f7 0%, #5f6975 40%);
background: -webkit-linear-gradient(top, #f7f7f7 0%, #5f6975 40%);
}
nav ul li:hover a {
color: #ff0000;
}
nav ul li a {
display: block;
padding: 25px 40px;
color: #f7f7f7;
text-decoration: none;
}
nav ul ul {
background: #f7f7f7;
border-radius: 0px;
padding: 0;
position: absolute;
top: 100%;
}
nav ul ul li {
float: none;
position: relative;
}
nav ul ul li a {
padding: 15px 40px;
}
nav ul ul li a:hover {
background: #888484;
color: #ff0000;
}
nav ul ul ul {
position: absolute;
left: 100%;
top: 0;
}
<nav>
<ul>
<li>Basin & Sinks</li>
<li>Showers
<ul>
<li>Shower Trays</li>
<li>Shower Glass
<ul>
<li>Frosted</li>
<li>Clear</li>
</ul>
</li>
</ul>
</li>
<li>Bathroom Accessories
<ul>
<li>Plugs</li>
<li>Toilet Paper</li>
</ul>
</li>
<li>Toilets</li>
</ul>
</nav>
Add:
nav ul {
width: 100%;
display:block;
}
But even with that you will have problem managing you columns to fit all width. You can use JS to calculate each width or use display: table for nav ul and display: table-cell for you ul li's
If you're looking on Chrome, Chrome adds 40px of padding as follows to <ul>'s:
-webkit-padding-start: 40px;
This is making the <ul> extend over the width you define.
There's 2 ways of overcoming this:
1. Remove all padding, including browser defaults
https://jsfiddle.net/pzod450b/1/
Simply add -webkit-padding-start: 0. On top of that, you've also added 20px of padding either side of the <ul>, remove this
CSS:
nav ul {
background: #1e1d1d;
background: linear-gradient(top, #1e1d1d 0%, #bbbbbb 100%);
background: -moz-linear-gradient(top, #1e1d1d 0%, #bbbbbb 100%);
background: -webkit-linear-gradient(top, #1e1d1d 0%,#bbbbbb 100%);
box-shadow: 0px 0px 9px rgba(0,0,0,0.15);
border-radius: 10px;
list-style: none;
position: relative;
display: inline-table;
width: 100%;
}
2. Use box-sizing: border-box
Using this method will ensure that the browser calculates all padding/border applied to an element within it's final width:
https://jsfiddle.net/u1vzag3b/
nav ul {
background: #1e1d1d;
background: linear-gradient(top, #1e1d1d 0%, #bbbbbb 100%);
background: -moz-linear-gradient(top, #1e1d1d 0%, #bbbbbb 100%);
background: -webkit-linear-gradient(top, #1e1d1d 0%,#bbbbbb 100%);
box-shadow: 0px 0px 9px rgba(0,0,0,0.15);
border-radius: 10px;
list-style: none;
position: relative;
display: inline-table;
width: 100%;
box-sizing: border-box;
}
You'll notice in both cases, you should add width: 100% to nav ul.
I am trying to make the list items in my un-ordered list fill the entire list. Because I have one list item that is two words, it is making the ul larger, but the others do not fill the space and I can only roll over and see the 2nd ul and am not able to get my mouse to access those buttons.
Here is the HTML
<div id="body_left_nav">
<nav>
<ul>
<li>Property Management
<ul>
<li>Commercial</li>
<li>Multi-Family</li>
</ul>
</li>
<li>Brokerage
<ul>
<li>Commercial</li>
<li>Multi-Family</li>
</ul>
</li>
<li>Leasing
<ul>
<li>Commercial</li>
</ul>
</li>
<li>Consulting
<ul>
<li>Commercial</li>
<li>Multi-Family</li>
</ul>
</li>
</ul>
</nav>
</div>
And the CSS
#body_left_nav{
width: 100%;
margin-left: 10px;
height: 100%;
}
#body_left_nav a {
font-weight: bold;
color: #000;
font-size: 14px;
}
#body_left_nav ul {
width: 100%;
background: #efefef;
background: linear-gradient(top, #efefef 0%, #004A65 100%);
background: -moz-linear-gradient(top, #efefef 0%, #004A65 100%);
background: -webkit-linear-gradient(top, #C4DAE8 0%,#004A65 100%);
box-shadow: 0px 0px 9px rgba(0,0,0,0.15);
border-radius: 10px;
list-style: none;
position: relative;
display: inline-table;
}
#body_left_nav ul li {
float: left;
width: 25%;
}
#body_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, #C4DAE8 0%,#004A65 40%);
}
#body_left_nav ul li a {
display: block;
padding: 20px;
color: #fff;
text-decoration: none;
text-align: center;
}
#body_left_nav ul li a:visited {
color: #fff;
}
#body_left_nav ul li:hover a {
color: #fff;
}
#body_left_nav ul li:hover > ul {
display: block;
top: 100%;
}
#body_left_nav ul:after {
clear: both;
display: block;
}
#body_left_nav ul ul {
width: 25%;
background: #5f6975;
border-radius: 0px;
position: absolute;
display: none;
}
#body_left_nav ul ul li {
width: 100%;
float: none;
background: #efefef;
background: linear-gradient(top, #efefef 0%, #004A65 100%);
background: -moz-linear-gradient(top, #efefef 0%, #004A65 100%);
background: -webkit-linear-gradient(top, #C4DAE8 0%,#004A65 100%);
box-shadow: 0px 0px 9px rgba(0,0,0,0.15);
border-top: 1px solid #D32026;
border-bottom: 1px solid #D32026;
position: relative;
}
#body_left_nav ul ul li a {
text-align: center;
color: #fff;
}
EDIT: Here is the jsfiddle http://jsfiddle.net/bv9j8ra5/
I don't know why the whole navigation and the ul ul are indented. It doesn't do that on my site but I still have the problem with the list item not filling the parent ul.
EDIT: This also might help. Here is an image of whats happening. I don't have a gap on "Property Management", but I have one on the other 3. [1]: http://i.stack.imgur.com/NbDnW.png
live Demo or
full view Demo
You just need a reset
*{box-sizing:border-box;padding:0;margin:0;}
Full code
*{box-sizing:border-box;padding:0;margin:0;}
#body_left_nav {
width: 100%;
height: 100%;
}
#body_left_nav a {
font-weight: bold;
color: #000;
font-size: 14px;
}
#body_left_nav ul {
width: 100%;
background: #efefef;
background: linear-gradient(top, #efefef 0%, #004A65 100%);
background: -moz-linear-gradient(top, #efefef 0%, #004A65 100%);
background: -webkit-linear-gradient(top, #C4DAE8 0%, #004A65 100%);
box-shadow: 0px 0px 9px rgba(0, 0, 0, 0.15);
border-radius: 10px;
list-style: none;
position: relative;
display: inline-table;
}
#body_left_nav ul li {
float: left;
width: 25%;
}
#body_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, #C4DAE8 0%, #004A65 40%);
}
#body_left_nav ul li a {
display: block;
padding: 20px;
color: #fff;
text-decoration: none;
text-align: center;
}
#body_left_nav ul li a:visited {
color: #fff;
}
#body_left_nav ul li:hover a {
color: #fff;
}
#body_left_nav ul li:hover > ul {
display: block;
top: 100%;
}
#body_left_nav ul:after {
clear: both;
display: block;
}
#body_left_nav ul ul {
width: 25%;
background: #5f6975;
border-radius: 0px;
position: absolute;
display: none;
}
#body_left_nav ul ul li {
width: 100%;
float: none;
background: #efefef;
background: linear-gradient(top, #efefef 0%, #004A65 100%);
background: -moz-linear-gradient(top, #efefef 0%, #004A65 100%);
background: -webkit-linear-gradient(top, #C4DAE8 0%, #004A65 100%);
box-shadow: 0px 0px 9px rgba(0, 0, 0, 0.15);
border-top: 1px solid #D32026;
border-bottom: 1px solid #D32026;
position: relative;
}
#body_left_nav ul ul li a {
text-align: center;
color: #fff;
}
<div id="body_left_nav">
<nav>
<ul>
<li>Property Management
<ul>
<li>Commercial
</li>
<li>Multi-Family
</li>
</ul>
</li>
<li>Brokerage
<ul>
<li>Commercial
</li>
<li>Multi-Family
</li>
</ul>
</li>
<li>Leasing
<ul>
<li>Commercial
</li>
</ul>
</li>
<li>Consulting
<ul>
<li>Commercial
</li>
<li>Multi-Family
</li>
</ul>
</li>
</ul>
</nav>
</div>
This is happening because you need to remove the margin and padding from the nested ul.
#body_left_nav ul ul {
width: 25%;
background: #5f6975;
border-radius: 0px;
position: absolute;
display: none;
margin: 0;
padding: 0;
EDIT:
There are several approaches on this, you can do it statically with padding.
Here is the applicable CSS:
#body_left_nav ul li {
float: left;
width: 25%;
height: 50px;
}
#body_left_nav ul li a {
display: block;
padding: 1.2em 0;
color: #fff;
text-decoration: none;
text-align: center;
}
Here is the new fiddle: http://jsfiddle.net/bv9j8ra5/3/
EDIT #2:
Or you can do it dynamically with relative positioning.
CSS:
#body_left_nav ul li {
float: left;
width: 25%;
height: 50px;
}
#body_left_nav ul li a {
display: block;
color: #fff;
text-decoration: none;
text-align: center;
position: relative;
top: 50%;
transform: translateY(-50%);
}
Here is the fiddle: http://jsfiddle.net/bv9j8ra5/5/
For some reason each bit of text in the navigation bars are aligning to the right. Is there any way to change this so it goes into the center of each part of the navigation menu? If somebody knows how to do this can you please help out because I am completely stumped.
HTML:
<div id="links">
<nav>
ul>
<li>Students
<ul>
<li>Search</li>
<li>Delete</li>
</ul>
<li>Teachers
<ul>
<li>Search</li>
<li>Delete</li>
</ul>
</li>
<li>Events
<ul>
<li>Search</li>
<li>Delete</li>
</ul>
</li>
<li>Nametag
<li>SignUp</li>
<li>Gallery
</ul>
CSS:
#links{
text-align: center;
margin-bottom: 20px;
margin-right: 100px;
margin-left: 100px;
background-color:#7A7A99;
padding-bottom: 2px;
padding-right: 50px;
padding-left: 50px;
border-bottom-left-radius:2em;
border-bottom-right-radius:2em;
}
#links a{
margin:25px;
width:10px;
height: 0px;
font-size: 20px;
margin-top: 3px;
}
nav ul {
background: #A3A3A3;
background: linear-gradient(top, #A3A3A3 0%, #666666 100%);
background: -moz-linear-gradient(top, #A3A3A3 0%, #666666 100%);
background: -webkit-linear-gradient(top, #A3A3A3 0%,#666666 100%);
box-shadow: 10px 6px 9px rgba(0,0,0,0.15);
padding: 0 20px;
border-radius: 8px;
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: #A3A3A3;
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: #FFFFFF; text-decoration: none;
}
nav ul ul {
background: #5f6975; border-radius: 0px; padding: 0;
position: absolute; top: 100%;
width: 140px;
}
nav ul ul li {
float: none;
border-top: 1px solid #6b727c;
border-bottom: 1px solid #575f6a;
position: relative;
}
nav ul ul li a {
padding: 0px 40px;
color: #fff;
}
nav ul ul li a:hover {
background: #A3A3A3;
}
Your anchors are fixed width, but not wide enough to hold the text. Consequently, it overflows out to the right.
add this css
#links{
text-align: center;
margin-bottom: 20px;
margin-right: 100px;
margin-left: 100px;
background-color:#7A7A99;
padding-bottom: 2px;
padding-right: 50px;
padding-left: 50px;
border-bottom-left-radius:2em;
border-bottom-right-radius:2em;
}
#links > a{
padding:10px;
font-size: 20px;
}
nav ul {
background: #A3A3A3;
background: linear-gradient(top, #A3A3A3 0%, #666666 100%);
background: -moz-linear-gradient(top, #A3A3A3 0%, #666666 100%);
background: -webkit-linear-gradient(top, #A3A3A3 0%,#666666 100%);
box-shadow: 10px 6px 9px rgba(0,0,0,0.15);
padding: 0 20px;
border-radius: 8px;
list-style: none;
position: relative;
display: inline-table;
}
nav ul:after {
content: ""; clear: both; display: block;
}
nav > ul > li {
float: left;
text-align: center;
}
nav ul li:hover {
background: #A3A3A3;
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 15px;
color: #FFFFFF; text-decoration: none;
font-size:20px;
}
nav ul ul {
background: #5f6975; border-radius: 0px; padding: 0;
position: absolute; top: 100%;
}
nav ul ul li {
border-top: 1px solid #6b727c;
border-bottom: 1px solid #575f6a;
position: relative;
}
nav ul ul li a {
padding: 10px 20px;
color: #fff;
display:block;
text-decoration:none;
}
nav ul ul li a:hover {
background: #A3A3A3;
}
EXAMPLE
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;
}
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.