CSS Drop Down issue - html

I have a very big issue with the Drop Down menu i have used the Css and HTML for the same.
The problem what i am facing is i need the background width of the nav to be 100% to the ontainer but niw when i am increasing the horizontal menu its shifting to next line
can you please help
body{
margin: 0;
padding: 0;
font-family: Helvetica, Arial, "Lucida Grande", sans-serif;
font-size: 87.5%;
}
.container{
width: 70%;
margin: 0 auto;
clear: both;
border:10px solid #0171bd;
}
.nav ul ul {
display: none;
}
.nav ul li:hover > ul {
display: block;
}
.nav ul {
background: #efefef;
background: linear-gradient(top, #0077bb 0%, #0171bd 100%);
background: -moz-linear-gradient(top, #0077bb 0%, #0171bd 100%);
background: -webkit-linear-gradient(top, #0077bb 0%,#0171bd 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: #bee6ff;
background: linear-gradient(top, #bee6ff 0%, #7dcdff 40%);
background: -moz-linear-gradient(top, #bee6ff 0%, #ffffff 50%);
background: -webkit-linear-gradient(top, #bee6ff 0%,#7dcdff 40%);
}
.nav ul li:hover a {
color: #363636;
}
.nav ul li a {
display: block; padding: 20px 12px;
color: #ffffff; text-decoration: none;
}
.nav ul ul {
background: #bee6ff;
background: linear-gradient(top, #bee6ff 0%, #7dcdff 40%);
background: -moz-linear-gradient(top, #bee6ff 0%, #ffffff 50%);
background: -webkit-linear-gradient(top, #bee6ff 0%,#7dcdff 40%);
border-radius: 0px;
padding: 0;
position: absolute; top: 100%;
}
.nav ul ul li {
float: none;
border-top: 1px solid #6cbdef;
border-bottom: 1px solid #6cbdef;
position: relative;
}
.nav ul ul li a {
padding: 15px 10px;
color: #fff;
}
.nav ul ul li a:hover {
background: #0075bb;
color:#FFF;
}
.nav ul ul ul {
position: absolute; left: 100%; top:0;
}
HTML Code is like below
<div class="container">
<div class="nav">
<ul>
<li>
Home</li>
<li>
Site Settings
<ul>
<li>Add Meta Tags</li>
<li>Add Page Title</li>
</ul>
</li>
<li>User Managment</li>
<li>
Upload Images
<ul>
<li>Upload Slider Image</li>
<li>Upload Ads Image</li>
</ul>
</li>
<li>Content Managment</li>
<li>
Devotees
<ul>
<li>Add Devotee</li>
<li>Edit Devotee</li>
</ul>
</li>
<li>
News
<ul>
<li>Add News</li>
<li>Edit News</li>
</ul>
</li>
<li>
Donation
<ul>
<li>View Request</li>
<li>Approve Request</li>
</ul>
</li>
<li>
Blogs
<ul>
<li>Add Blog</li>
<li>Edit Blog</li>
</ul>
</li>
</ul>
</div>
</div>

here is answer for same
.nav ul ul {
width: auto;
}

Please check once
body{
margin: 0;
padding: 0;
font-family: Helvetica, Arial, "Lucida Grande", sans-serif;
font-size: 87.5%;
}
.container{
width: 70%;
margin: 0 auto;
clear: both;
border:10px solid #0171bd;
}
.nav ul ul {
display: none;
}
.nav ul li:hover > ul {
display: block;
}
.nav ul {
background: #efefef;
background: linear-gradient(top, #0077bb 0%, #0171bd 100%);
background: -moz-linear-gradient(top, #0077bb 0%, #0171bd 100%);
background: -webkit-linear-gradient(top, #0077bb 0%,#0171bd 100%);
box-shadow: 0px 0px 9px rgba(0,0,0,0.15);
padding: 0 20px;
border-radius: 10px;
list-style: none;
position: relative;
}
#nav > ul{display: table;}
.nav ul:after {
content: ""; clear: both; display: block;
}
.nav > ul > li {
display: table-cell;
}
.nav ul li:hover {
background: #bee6ff;
background: linear-gradient(top, #bee6ff 0%, #7dcdff 40%);
background: -moz-linear-gradient(top, #bee6ff 0%, #ffffff 50%);
background: -webkit-linear-gradient(top, #bee6ff 0%,#7dcdff 40%);
}
.nav ul li:hover a {
color: #363636;
}
.nav ul li a {
display: block; padding: 20px 12px;
color: #ffffff; text-decoration: none;
}
.nav ul ul {
background: #bee6ff;
background: linear-gradient(top, #bee6ff 0%, #7dcdff 40%);
background: -moz-linear-gradient(top, #bee6ff 0%, #ffffff 50%);
background: -webkit-linear-gradient(top, #bee6ff 0%,#7dcdff 40%);
border-radius: 0px;
padding: 0;
position: absolute; top: 100%;
}
.nav ul ul li {
float: none;
border-top: 1px solid #6cbdef;
border-bottom: 1px solid #6cbdef;
position: relative;
}
.nav ul ul li a {
padding: 15px 10px;
color: #fff;
}
.nav ul ul li a:hover {
background: #0075bb;
color:#FFF;
}
.nav ul ul ul {
position: absolute; left: 100%; top:0;
}
#media only screen
and (max-width : 992px) {
/* Styles */
.nav ul{
font-size: 12px;
padding: 0 5px;
}
.nav > ul > li > a{
padding: 10px 5px !important;
}
<div class="container">
<div class="nav">
<ul>
<li>
Home</li>
<li>
Site Settings
<ul>
<li>Add Meta Tags</li>
<li>Add Page Title</li>
</ul>
</li>
<li>User Managment</li>
<li>
Upload Images
<ul>
<li>Upload Slider Image</li>
<li>Upload Ads Image</li>
</ul>
</li>
<li>Content Managment</li>
<li>
Devotees
<ul>
<li>Add Devotee</li>
<li>Edit Devotee</li>
</ul>
</li>
<li>
News
<ul>
<li>Add News</li>
<li>Edit News</li>
</ul>
</li>
<li>
Donation
<ul>
<li>View Request</li>
<li>Approve Request</li>
</ul>
</li>
<li>
Blogs
<ul>
<li>Add Blog</li>
<li>Edit Blog</li>
</ul>
</li>
</ul>
</div>
</div>
you can decrease font-size for lower version using media queries.

Related

CSS Vertical align center for text inside of ListItem

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/

Sub Nav doesnt display below horizontally

I am creating a nav bar with further sub lists. The first sub list displays exactly how I want it, but the one below that does not. Rather than display horizontally below the initial sub nav bar, it displays vertically and to the right of it.
Does anyone have any idea why this is, I believe I am missing something but for the life of me cant find it.
I added a photo to explain what I would like. The red should appear where the blue is.
Appreciate your time!
nav {
margin: 0 auto;
text-align: center;
}
nav ul ul {
display: none;
}
nav ul li:hover > ul {
display: block;
}
nav ul {
color: white;
background: #787878;
background: linear-gradient(top, #787878 0%, #272727 100%);
background: -moz-linear-gradient(top, #787878 0%, #272727 100%);
background: -webkit-linear-gradient(top, #787878 0%, #272727 100%);
box-shadow: 0px 0px 9px rgba(0, 0, 0, 0.15);
padding: 0 20px;
border-radius: 25px;
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: #A8A8A8;
}
nav ul li:hover a {
color: #fff;
}
nav ul li a {
display: block;
padding: 15px 50px;
color: white;
text-decoration: none;
}
nav ul ul {
background: #505050;
border-radius: 0px;
padding: 0;
position: absolute;
top: 100%;
}
nav ul ul li {
float: left;
border-top: 1px solid #6b727c;
border-bottom: 1px solid #575f6a;
position: relative;
}
nav ul ul li a {
padding: 8px 40px;
color: #fff;
}
nav ul ul li a:hover {
background: #A8A8A8;
}
nav ul ul ul {
position: absolute;
left: 100%;
top: 0;
}
nav ul ul.ul-right {
right: 0;
}
<nav>
<ul>
<li>Players
<ul>
<li>Wonderkids
</li>
<li>Cheap Players
</li>
<li>Player Comparisons
</li>
</ul>
</li>
<li>Clubs
<ul>
<li>Club Info
</li>
<li>Transfer Budgets
</li>
<li>Sugar Daddys
</li>
</ul>
</li>
<li>Downloads
<ul>
<li>Tactics
</li>
<li>Shortlists
<ul>
<li>Various Shortlists
</li>
<li>Positional Shortlists
</li>
<li>Staff Shortlists
</li>
</ul>
</li>
</ul>
</li>
<li>Write-Ups
</li>
<li>Social
<ul class="ul-right">
<li>Facebook
</li>
<li>Twitter
</li>
<li>Youtube
</li>
<li>Affiliates
</li>
</ul>
</li>
<li>About Us
</li>
</ul>
</nav>
If You have no problem setting the width of the ul this might be a solution:
nav {
margin: 0 auto;
text-align: center;
}
nav ul ul {
display: none;
}
nav ul li:hover > ul {
display: block;
}
nav ul {
color: white;
background: #787878;
background: linear-gradient(top, #787878 0%, #272727 100%);
background: -moz-linear-gradient(top, #787878 0%, #272727 100%);
background: -webkit-linear-gradient(top, #787878 0%, #272727 100%);
box-shadow: 0px 0px 9px rgba(0, 0, 0, 0.15);
padding: 0 20px;
border-radius: 25px;
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: #A8A8A8;
}
nav ul li:hover a {
color: #fff;
}
nav ul li a {
display: block;
padding: 15px 50px;
color: white;
text-decoration: none;
}
nav ul ul {
background: #505050;
border-radius: 0px;
padding: 0;
position: absolute;
top: 100%;
}
nav ul ul li {
float: left;
border-top: 1px solid #6b727c;
border-bottom: 1px solid #575f6a;
position: relative;
}
nav ul ul li a {
padding: 8px 40px;
color: #fff;
}
nav ul ul li a:hover {
background: #A8A8A8;
}
nav ul ul ul {
position: absolute;
top: 100%;
width: 578px;
}
nav ul ul.ul-right {
right: 0;
}
<nav>
<ul>
<li>Players
<ul>
<li>Wonderkids
</li>
<li>Cheap Players
</li>
<li>Player Comparisons
</li>
</ul>
</li>
<li>Clubs
<ul>
<li>Club Info
</li>
<li>Transfer Budgets
</li>
<li>Sugar Daddys
</li>
</ul>
</li>
<li>Downloads
<ul>
<li>Tactics
</li>
<li>Shortlists
<ul>
<li>Various Shortlists
</li>
<li>Positional Shortlists
</li>
<li>Staff Shortlists
</li>
</ul>
</li>
</ul>
</li>
<li>Write-Ups
</li>
<li>Social
<ul class="ul-right">
<li>Facebook
</li>
<li>Twitter
</li>
<li>Youtube
</li>
<li>Affiliates
</li>
</ul>
</li>
<li>About Us
</li>
</ul>
</nav>

Horizontal Nav Bar Sub Navs Wrapping Down instead of using space behind(left) of it

So the problem I have is that if I select the last option on my nav bar, because the drop down has so many options, it exceeds the length left of the nav bar and wraps underneath, creating a grid of options 2x2.
I would much prefer if it used the space to the left rather than wrapping down. how can I make this possible.
nav {
margin: 0 auto;
text-align: center;
}
nav ul ul {
display: none;
}
nav ul li:hover > ul {
display: block;
}
nav ul {
color: white;
background: #787878;
background: linear-gradient(top, #787878 0%, #272727 100%);
background: -moz-linear-gradient(top, #787878 0%, #272727 100%);
background: -webkit-linear-gradient(top, #787878 0%, #272727 100%);
box-shadow: 0px 0px 9px rgba(0, 0, 0, 0.15);
padding: 0 20px;
border-radius: 25px;
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: #A8A8A8;
}
nav ul li:hover a {
color: #fff;
}
nav ul li a {
display: block;
padding: 15px 50px;
color: white;
text-decoration: none;
}
nav ul ul {
background: #505050;
border-radius: 0px;
padding: 0;
position: absolute;
top: 100%;
}
nav ul ul li {
float: left;
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: #A8A8A8;
}
nav ul ul ul {
position: absolute;
left: 100%;
top: 0;
}
<nav>
<ul>
<li>Players
<ul>
<li>Wonderkids
</li>
<li>Cheap Players
</li>
<li>Player Comparisons
</li>
</ul>
</li>
<li>Clubs
<ul>
<li>Club Info
</li>
<li>Transfer Budgets
</li>
<li>Sugar Daddys
</li>
</ul>
</li>
<li>Downloads
<ul>
<li>Tactics
</li>
<li>Shortlists
<ul>
<li>Various Shortlists
</li>
<li>Positional Shortlists
</li>
<li>Staff Shortlists
</li>
</ul>
</li>
</ul>
</li>
<li>Write-Ups
</li>
<li>Social
<ul>
<li>Facebook
</li>
<li>Twitter
</li>
<li>Youtube
</li>
<li>Affiliates
</li>
</ul>
</li>
<li>About Us
</li>
</ul>
</nav>
The problem is that the submenu is aligned on the left edge of the parent item in the main menu. Let's align the submenu on the right edge of the main menu.
Add class ul-right to the corresponding <ul>.
Add CSS-code nav ul ul.ul-right { right: 0; }.
Check the result:
nav {
margin: 0 auto;
text-align: center;
}
nav ul ul {
display: none;
}
nav ul li:hover > ul {
display: block;
}
nav ul {
color: white;
background: #787878;
background: linear-gradient(top, #787878 0%, #272727 100%);
background: -moz-linear-gradient(top, #787878 0%, #272727 100%);
background: -webkit-linear-gradient(top, #787878 0%, #272727 100%);
box-shadow: 0px 0px 9px rgba(0, 0, 0, 0.15);
padding: 0 20px;
border-radius: 25px;
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: #A8A8A8;
}
nav ul li:hover a {
color: #fff;
}
nav ul li a {
display: block;
padding: 15px 50px;
color: white;
text-decoration: none;
}
nav ul ul {
background: #505050;
border-radius: 0px;
padding: 0;
position: absolute;
top: 100%;
}
nav ul ul.ul-right {
right: 0;
}
nav ul ul li {
float: left;
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: #A8A8A8;
}
nav ul ul ul {
position: absolute;
left: 100%;
top: 0;
}
<nav>
<ul>
<li>Players
<ul>
<li>Wonderkids
</li>
<li>Cheap Players
</li>
<li>Player Comparisons
</li>
</ul>
</li>
<li>Clubs
<ul>
<li>Club Info
</li>
<li>Transfer Budgets
</li>
<li>Sugar Daddys
</li>
</ul>
</li>
<li>Downloads
<ul>
<li>Tactics
</li>
<li>Shortlists
<ul>
<li>Various Shortlists
</li>
<li>Positional Shortlists
</li>
<li>Staff Shortlists
</li>
</ul>
</li>
</ul>
</li>
<li>Write-Ups
</li>
<li>Social
<ul class="ul-right">
<li>Facebook
</li>
<li>Twitter
</li>
<li>Youtube
</li>
<li>Affiliates
</li>
</ul>
</li>
<li>About Us
</li>
</ul>
</nav>

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.