CSS won't change colour - html

Bought a template, and been working on this for the last couple of days. On my wits end now. I am trying to change the hover over main nav colour and current chosen page colour, to no avail. Please advice?
Code attached.
nav#main-nav {
z-index: 50;
display: block;
}
nav#main-nav ul {
position: relative;
z-index: 49;
margin: 0;
padding: 0;
list-style: none;
}
nav#main-nav ul li {
position: relative;
z-index: 45;
float: left;
margin: 0 0 0 20px;
padding: 0;
}
nav#main-nav > ul > li > a {
display: block;
font-family: Ubuntu;
font-size: 13px;
line-height: 40px;
color: #ffffff;
text-decoration: uppercase;
position: relative;
z-index: 45;
padding: 20px 0;
letter-spacing: 0.1em;
}
nav#main-nav > ul > li:hover {
z-index: 46;
color: #ffffff;
}
nav#main-nav > ul > li.current-menu-item,
nav#main-nav > ul > li.current-menu-ancestor {
color: #ffffff;
text-decoration: underline;
}
nav#main-nav ul li .sub-menu {
position: absolute;
top: 80px;
left: 0px;
width: 200px;
padding: 0;
display: none;
z-index: 47;
}
nav#main-nav ul .sub-menu li {
float: none;
border-top: 1px solid;
margin: 0;
}
nav#main-nav ul .sub-menu li:first-child {
border-top: none;
}
nav#main-nav ul .sub-menu li a {
color: #ffffff;
font-size: 12px;
line-height: 20px;
padding: 10px 20px;
display: block;
}
nav#main-nav ul .sub-menu li:hover {
background-color: #ffffff;
}
nav#main-nav ul .sub-menu li:hover a {
color: #ffffff;
}
nav#main-nav ul .sub-menu li.current-menu-item > a {
color: #ffffff;
text-decoration: underline;
}
nav#main-nav ul li ul li .sub-menu {
border-top: none;
position: absolute;
top: 0px;
left: 201px;
}

You have
nav#main-nav > ul > li:hover {
z-index: 46;
color: #ffffff;
}
The problem is that the anchor has other styles that override the code above. Then, use
nav#main-nav > ul > li:hover { z-index: 46; }
nav#main-nav > ul > li:hover > a {
color: #ffffff;
}

Related

Dropdown hover menu not showing up in IE/Edge

I'm using the theme Illdy on a Wordpress site handed to me, and the hoverable dropdown menus on the top navbar are not dropping down in IE or Edge. Firefox and Chrome appear to work.
I've tried adding a variety of these to the additional CSS:
#header .top-header .header-navigation ul li:hover > ul.sub-menu {
visibility: visible;
}
.header-navigation .menu > li:hover > ul {
opacity: 1;
transform: translate3d(0, 0px, 0);
-webkit-transform: translate3d(0, 0px, 0);
-moz-transform: translate3d(0, 0px, 0);
visibility: visible;
}
.header-navigation .menu-item>li>ul li:hover>a {
opacity: 1;
}
to no avail.
The theme's original CSS pertaining to the top navbar menu is:
#header .top-header .header-logo {
display: block;
font-size: 60px;
color: #fff;
-webkit-transition: all 0.3s;
-moz-transition: all 0.3s;
-o-transition: all 0.3s;
transition: all 0.3s;
line-height: 75px;
font-weight: 700;
}
#header .top-header .header-logo:hover,
#header .top-header .header-logo:focus {
color: #f1d204;
text-decoration: none;
}
#header .top-header .header-navigation {
float: right;
}
#header .top-header .header-navigation ul {
width: 100%;
margin: 0;
padding: 0;
list-style-type: none;
}
#header .top-header .header-navigation > ul {
margin-top: 20px;
}
#header .top-header .header-navigation ul li {
margin-left: 40px;
line-height: 40px;
font-weight: 700;
font-size: 14px;
color: #fff;
position: relative;
float: left;
font-family: "Lato";
}
#header .top-header .header-navigation ul li:first-child {
margin-left: 0;
}
#header .top-header .header-navigation ul li.menu-item-has-children a {
padding-right: 16px;
position: relative;
margin-bottom: 20px;
display: inline-block;
}
#header .top-header .header-navigation ul li.menu-item-has-children a:after {
content: "\f107";
font-family: "FontAwesome";
font-size: 16px;
position: absolute;
top: 0;
right: 0;
}
#header .top-header .header-navigation ul li.menu-item-has-children .sub-menu {
width: 200px;
margin: -5px 0 0;
padding: 0;
position: absolute;
left: 50%;
display: none;
z-index: 10;
background-color: #fff;
-webkit-box-shadow: 0px 0px 20px 2px rgba(0, 0, 0, 0.32);
-moz-box-shadow: 0px 0px 20px 2px rgba(0, 0, 0, 0.32);
box-shadow: 0px 0px 20px 2px rgba(0, 0, 0, 0.32);
transform: translateX(-50%);
}
#header .top-header .header-navigation ul li.menu-item-has-children .sub-menu:before {
display: block;
content: "";
position: absolute;
top: -5px;
left: 50%;
margin-left: -3px;
border-left: 5px solid transparent;
border-right: 5px solid transparent;
border-bottom: 5px solid #fff;
width: 0;
height: 0;
}
#header .top-header .header-navigation ul li.menu-item-has-children .sub-menu .sub-menu {
transform: translateX(0);
}
#header .top-header .header-navigation ul li.menu-item-has-children .sub-menu .sub-menu:before {
display: none;
}
#header .top-header .header-navigation ul li.menu-item-has-children .sub-menu li {
width: 100%;
margin: 0;
padding: 0;
background-color: #fff;
}
#header .top-header .header-navigation ul li.menu-item-has-children .sub-menu li:first-child {
padding-top: 10px;
}
#header .top-header .header-navigation ul li.menu-item-has-children .sub-menu li:last-child {
padding-bottom: 10px;
}
#header .top-header .header-navigation ul li.menu-item-has-children .sub-menu li a {
width: 100%;
margin: 0;
padding: 0 10px;
line-height: 40px;
font-weight: 400;
font-size: 14px;
color: #8c9597;
text-transform: none;
display: block;
font-family: "Lato";
}
#header .top-header .header-navigation ul li.menu-item-has-children .sub-menu li:hover > a,
#header .top-header .header-navigation ul li.menu-item-has-children .sub-menu li:focus-within > a {
color: #f1d204;
border-left: 3px solid #f1d204;
background-color: #f8f8f8;
}
#header .top-header .header-navigation ul li.menu-item-has-children .sub-menu li a:after {
display: none;
}
#header .top-header .header-navigation ul li a {
color: #fff;
font-size: 16px;
line-height: 26px;
}
#header .top-header .header-navigation ul li:hover a,
#header .top-header .header-navigation ul li:focus-within a {
color: #ffde00;
text-decoration: none;
}
Add <meta http-equiv="X-UA-Compatible" content="IE=9"/> between the head tags. I personally used this and I had no problems with either IE or Edge. You should also check the syntax which could be read differently and wrong.

White space before sub menu, what's wrong?

In this site I have a problem with the submenu that appears in the main navigation, there's a space before the list with the links I don't know why it changed but it appeared fine before, I really don't have an idea of what happened
#navigation {
float: right;
}
#navigation li {
float: left;
font-size: 12px;
text-transform: uppercase;
letter-spacing: 0.1em;
display: block;
}
#navigation li strong {
font-weight: 400;
border-right: #e8e8e8 1px solid;
display: block;
padding: 10px 20px;
}
#navigation li a {
padding: 20px 0;
color: #1c1c1c;
text-decoration: none;
display: block;
}
#navigation li:last-child strong {
border-right: none;
}
#navigation li span {
display: block;
color: #a09d9d;
text-transform: lowercase;
letter-spacing: 0.01em;
margin: 5px 0 0 0;
}
#navigation li a:hover span,
#navigation li:hover span,
#navigation li.current-menu-item a span {
color: #1c1c1c;
}
#navigation li li.current-menu-item,
#navigation li li.current_page_item,
#navigation li li:hover {
border-bottom: none;
}
#navigation li li,
#navigation li li:hover {
text-transform: none;
letter-spacing: 0;
border-bottom: #e8e8e8 1px solid;
}
#navigation li li a.sf-with-ul:after {
background: url(../images/arrows2.png) no-repeat;
width: 8px;
height: 8px;
content: '';
position: absolute;
top: 36%;
right: 1em;
}
#navigation li li a {
padding: 15px 20px;
background: #fff;
font-size: 13px;
}
#navigation li li a:hover {
background: #fafafa;
}
#navigation .current-menu-item,
#navigation .current_page_item,
#navigation li:hover {
border-bottom: 4px solid;
}
#navigation li ul {
box-shadow: 0 0 4px rgba(136, 136, 136, 0.6);
}
Seems like the top attribute value is just to high, change it to 93px
#navigation li:hover ul, #navigation li.sfHover ul {
left: 0.01em;
top: 93px;
z-index: 99;
}
Here is an another possible option from Bart:
#navigation li:hover ul, #navigation li.sfHover ul {
left: 0.01em;
top: 100%;
z-index: 99;
}
This seems to work too.
#navigation ul {
position: absolute;
width: 19em;
top: -999em;
margin-top: -39px;
}
In situations like this, i suggest you to use Firebug or Developer Tools integrated on your browser. A very little check using the Inspector tool (found in all developer tools and on Firebug) could have shown you how to resolve this problem very easily.
Or.......
Just remove:
top: -999em;
from:
#navigation ul {
position: absolute;
/* top: -999em; */
width: 19em;
}

How to make a horizontal expandable menu fluid

I have the following HTML code which displays a horizontal expandable menu inside a DIV:
<div id='cssmenu'>
<ul>
<li class='active'><a href='about_us.aspx'>ABOUT US</a></li>
<li>MISSION</li>
<li class='has-sub'><a href='#'>LEADERSHIP</a>
<ul>
<li><a href='#'>President</a></li>
<li><a href='#'>Medical Director</a></li>
<li><a href='#'>Board of Directors</a></li>
<li><a href='#'>Key Administrators</a></li>
</ul>
</li>
<li><a href='#'>WESTMED HISTORY</a></li>
<li><a href='#'>COMMUNITY SUPPORT</a></li>
</ul>
</div>
Here is my CSS for the menu:
#import url(http://fonts.googleapis.com/css?family=Oxygen+Mono);
#cssmenu {
padding: 0;
margin: 0;
border: 0;
width: 100%;
}
#cssmenu ul, #cssmenu li {
list-style: none;
margin: 0;
padding: 0;
}
#cssmenu ul {
position: relative;
z-index: 19;
}
#cssmenu ul li {
float: left;
min-height: 1px;
vertical-align: middle;
border-right: 1px solid #535353;
}
#cssmenu ul li:last-child {
border-right: none;
}
#cssmenu ul li.hover, #cssmenu ul li:hover {
position: relative;
z-index: 20;
cursor: default;
}
#cssmenu ul ul {
visibility: hidden;
position: absolute;
top: 100%;
left: 0;
z-index: 21;
width: 100%;
}
#cssmenu ul ul li {
float: none;
}
#cssmenu ul ul ul {
top: 0;
left: auto;
right: -99.5%;
}
#cssmenu ul li:hover > ul {
visibility: visible;
}
#cssmenu ul ul {
bottom: 0;
left: 0;
}
#cssmenu ul ul {
margin-top: 0;
}
#cssmenu ul ul li {
font-weight: normal;
}
#cssmenu a {
display: block;
line-height: 1em;
text-decoration: none;
}
#cssmenu {
background: #333;
border-bottom: 4px solid #1b9bff;
font-family: Tahoma, Arial, sans-serif;
font-size: 12px;
}
#cssmenu > ul {
*display: inline-block;
}
#cssmenu:after, #cssmenu ul:after {
content: '';
display: block;
clear: both;
}
#cssmenu a {
background: #333;
color: #CBCBCB;
padding: 0 12px;
}
#cssmenu ul {
text-transform: uppercase;
}
#cssmenu ul ul {
border-top: 4px solid #1b9bff;
text-transform: none;
min-width: 190px;
}
#cssmenu ul ul a {
background: #1b9bff;
color: #FFF;
border: 1px solid #0082e7;
border-top: 0 none;
line-height: 150%;
padding: 16px 20px;
}
#cssmenu ul ul ul {
border-top: 0 none;
}
#cssmenu ul ul li {
position: relative;
}
#cssmenu > ul > li > a {
line-height: 48px;
}
#cssmenu ul ul li:first-child > a {
border-top: 1px solid #0082e7;
}
#cssmenu ul ul li:hover > a {
background: #35a6ff;
}
#cssmenu ul ul li:last-child > a {
border-radius: 0 0 3px 3px;
box-shadow: 0 1px 0 #1b9bff;
}
#cssmenu ul ul li:last-child:hover > a {
border-radius: 0 0 0 3px;
}
#cssmenu ul ul li.has-sub > a:after {
content: '+';
position: absolute;
top: 50%;
right: 15px;
margin-top: -8px;
}
#cssmenu ul li:hover > a, #cssmenu ul li.active > a {
background: #1b9bff;
color: #FFF;
}
#cssmenu ul li.has-sub > a:after {
content: '+';
margin-left: 5px;
}
#cssmenu ul li.last ul {
left: auto;
right: 0;
}
#cssmenu ul li.last ul ul {
left: auto;
right: 99.5%;
}
For desktop and large screen it works great but whenever I load it inside a tablet the image goes over to the next line:
How can I make the menu more fluid, so it resizes based on the amount of space that's available to the cssmenu DIV?
Check out flexbox, this might be an option for you.
This demo is pretty handy, you would choose space-around (if I understood your question correctly): http://codepen.io/chriscoyier/pen/FAbpm

How to make nav bar stretch the full width of my page

I want to make my navigation bar stretch the full width of my page, but it doesnt want to stretch everytime I use width 100% the navbar just break and lose its form. I'm not using any javascript and i think the problem is on the .horizontal-centering class CMIW
JSFiddle
I'm using pure css nav bar
/* dropdown.css */
ul.dropdown, ul.dropdown li, ul.dropdown ul {
list-style: none;
margin: 0;
padding: 0;
}
ul.dropdown {
position: relative;
z-index: 597;
float: left;
}
ul.dropdown li {
float: left;
min-height: 1px;
line-height: 1.3em;
vertical-align: middle;
}
ul.dropdown li.hover, ul.dropdown li:hover {
position: relative;
z-index: 599;
cursor: default;
}
ul.dropdown ul {
visibility: hidden;
position: absolute;
top: 100%;
left: 0;
z-index: 598;
width: 100%;
}
ul.dropdown ul li {
float: none;
}
ul.dropdown ul ul {
top: 1px;
left: 99%;
}
ul.dropdown li:hover > ul {
visibility: visible;
}
/* default.css */
ul.dropdown {
font: normal 16px"Square", Arial, Helvetica, sans-serif;
text-transform: uppercase;
}
ul.dropdown li {
padding: 7px 0;
background-color: #000;
color: #fff;
line-height: normal;
}
ul.dropdown a:link, ul.dropdown a:visited {
color: #fff;
text-decoration: none;
}
ul.dropdown a:hover {
color: #005CE6;
text-decoration: none;
}
ul.dropdown a:active {
color: #fff;
}
ul.dropdown ul {
width: 170px;
background-color: #333;
color: #fff;
font-size: 12px;
text-transform: none;
filter: alpha(opacity=90);
-moz-opacity: .9;
KhtmlOpacity: .9;
opacity: .9;
}
ul.dropdown ul li {
background-color: transparent;
color: #000;
filter: none;
}
ul.dropdown ul li.hover, ul.dropdown ul li:hover {
background-color: transparent;
}
ul.dropdown ul a:link, ul.dropdown ul a:visited {
color: #fff;
}
ul.dropdown ul a:hover {
color: #fff;
text-decoration: none;
}
ul.dropdown ul a:active {
color: #fff;
}
ul.dropdown *.dir {
padding-right: 12px;
background-image: none;
background-position: 100% 50%;
background-repeat: no-repeat;
}
/* default.advanced.css */
ul.dropdown li a {
display: block;
padding: 7px 14px;
}
ul.dropdown li {
padding: 0;
}
ul.dropdown li.dir {
padding: 7px 20px 7px 14px;
}
ul.dropdown ul li.dir {
padding-right: 15px;
}
ul.dropdown ul a {
padding: 4px 5px 4px 14px;
width: 151px;
}
ul.dropdown ul a:hover {
background-color: #005CE6;
}
ul.dropdown li:hover > a.dir {
background-color: #2e2e2e;
color: #005CE6;
}
ul.dropdown ul li:hover > a.dir {
background-color: #76b900;
color: #fff;
}
html { *overflow-x: hidden; }
body { padding: 0; }
body, html { height: 100%; padding: 0; margin: 0; }
.wrapper { min-height: 100%; min-width: 950px;overflow: hidden; }
.container { padding: 50px; }
.horizontal-centering { position: relative; }
.horizontal-centering > * > * { float: left; width: auto; position: relative; left: 50%; margin: 0; padding: 0; }
.horizontal-centering > * > * > * { float: left; position: relative; right: 50%; }
Instead of using overflow hidden to clear the floats by using a clearfix helper class this made the second level appear.
/* helper class for clearing floats */
.clearfix:after{
display: block;
visibility: hidden;
clear: both;
height: 0;
content:".";
}
.clearfix {
display: inline-block;
}
.clearfix{
display: block;
}
Reworked the dropdown and centering a little
.horizontal-centering {
background: #000000;
position: relative;
}
.horizontal-centering > div > div {
clear: both;
float: left;
width: 100%;
}
.dropdown-horizontal {
float: left;
width: auto;
position: relative;
left: 50%;
margin: 0;
padding: 0;
}
ul.dropdown > li > ul {
visibility: hidden;
position: absolute;
width: auto;
left: 0;
}
ul.dropdown > li:hover > ul {
visibility: visible;
}
ul.dropdown, ul.dropdown li, ul.dropdown ul {
list-style: none;
margin: 0;
padding: 0;
}
ul.dropdown {
float: left;
left: 50%;
list-style-type: none;
margin: 0 auto;
padding: 0;
position: relative;
}
ul.dropdown > li {
float: left;
position: relative;
right: 50%;
line-height: 1.3em;
}
ul.dropdown li.hover, ul.dropdown li:hover {
cursor: default;
}
ul.dropdown ul li {
float: none;
}
http://fiddle.jshell.net/35JPL/26/
http://fiddle.jshell.net/35JPL/26/show/
Check this fiddle based on yours: http://jsfiddle.net/u67qx/
I added width:100% to some classes and I deleted left:50%; and right:50%;. Looks like this is what you want. You can align text to center.

Sub menu of dropdown menu pushing ul li

here is what's happening.
As required!
http://jsfiddle.net/U99Br/
So I'm making this web site with a drop down menu, until now it was all good, but while doing my drop-down menu (I wanted to do something of the sort of Netflix's menu), I noticed my sub-menu is pushing the "contact" li tag 300px away (which is it's length).
Here's my code:
#menu,
#menu ul,
#menu li {
margin: 0;
padding: 0;
list-style: none;
}
#menu a {
text-decoration: none;
}
#menu {
height: 60px;
width: auto;
}
#menu > ul > li {
float: left;
margin-left: 15px;
position: relative;
}
#menu > ul > li > a {
color: #fff;
text-shadow: 1px 1px 5px #737373;
font-size: 20px;
line-height: 60px;
padding: 15px 20px;
}
#menu > ul > li > a:hover {
color: #000;
}
#menu > ul > li > ul {
opacity: 0;
visibility: hidden;
display: none;
background-color: #fff;
text-align: left;
height: auto;
box-shadow: 0px 1px 2px rgba(0, 0, 0, 0.4);
width: 300px;
}
#menu > ul > li:hover > ul {
display: block;
border: none;
visibility: visible;
opacity: 1;
}
#menu > ul > li > ul > li {
display: block;
content: '';
}
#menu > ul > li > ul > li > a {
font-size: 12px;
color: #000;
display: block;
text-shadow: none;
}
#menu > ul > li > ul > li > a:hover {
color: #0AB3FC;
}
#menu > ul ul > li {
position: relative;
}
I have not found what's wrong in my coding yet!
ad a width to the first ul li so children can not push up width from parent
#menu > ul > li {
width:300px; /* add with here */
float: left;
margin-left: 15px;
position: relative;
}