I ma trying to create responsive mega menu with foundation,the problem is that i try every thing but i can't change the color of the right part of my menu it is still black.i change the color of top-bar and it is gray now but the .top-bar-section doesn't change.here is my CSS code:
.top-bar{
background-color:gray !important;
}
.top-bar .expanded{
background-color:gray !important;
}
.top-bar-section ul li.active>a{
color:black !important;
background-color:gray !important;
}
.mega-menu {
border-top: 1px solid #222;
}
.mega-menu .top-bar-section .right> li{
background-color:blue !important;
}
/* Change tab hover state to same colour as content background */
.mega-menu .top-bar .top-bar-section li:hover > a {
color: #222;
background: #FFF;
}
I want to change the background color of the in top-bar-section,but it dosen't change
here is a part of my code:
<div class="mega-menu">
<nav class="top-bar" data-topbar="">
<ul class="title-area">
<li class="name">
<h1>Tojjar</h1>
</li>
<li class="toggle-topbar menu-icon"><span>Menu</span></li>
</ul>
<section class="top-bar-section">
<ul class="right">
<li><a><strong class="fontstyle">درباره ما</strong></a></li>
<li><a><strong class="fontstyle">راهنما</strong></a></li>
<li><a><strong class="fontstyle">تماس با ما</strong></a></li>
thanks.
On my most recent install of FoundationPress, I believe it was the following two properties:
.top-bar-section li.active:not(.has-form) a:not(.button) {background:$color !important;}
And
#media only screen and (min-width: 64.063em){.top-bar-section li:not(.has-form) a:not(.button):hover {background:$color !important;}}
And that side block matched the color I wanted.
(The top-bar color didn't change those two settings)
Related
I am styling a navbar using CSS to modify the .navbar-inverse within Bootstrap 3.
My current HTML:
<li class="dropdown">
<a class="dropdown-toggle hvr-glow" data-toggle="dropdown" href="#">My Sites
<span class="caret"></span></a>
<ul class="dropdown-menu">
<li>LinkedIn</li>
<li>Github</li>
<li>CodeSandbox</li>
</ul>
I want the to change the color of the link tag that says "My Sites" when I hover over it. Currently, when I hover the link it changes to the same color as the background, which is the color that the other links are supposed to be when hovered over... I do not want to change the hover effect of the other links.
My current CSS for the navbar is:
#banner{
width: 100%;
}
.navbar-brand{
letter-spacing: 3px;
color: #FDFFFC !important;
background-color: #011627 !important;
}
.navbar-brand:hover{
color: #E71D36 !important;
}
.navbar{
background-color: #011627 !important;
border: none !important;
}
.navbar-nav a{
color: #FDFFFC !important;
}
.navbar-nav a:hover{
color: #2EC4B6 !important;
}
.dropdown-menu{
background-color: #FF9F1C !important;
}
.dropdown-menu a:hover{
color: #011627 !important;
background-color: #FF9F1C !important;
}
.dropdown-toggle{
background-color: #2EC4B6 !important;
}
.navbar-inverse .navbar-nav > .active > a:hover{
color: #011627 !important;
}
Picture:
CSS next to my page. I am hovering the link that I cannot target
Try adding this?
.dropdown .dropdown-toggle:hover {
color: red;
}
and obviously change red in the hover to whatever color you want. Also you should only really use !important when its necessary, even for bootstrap where it is used a lot, you seem to be using it a little too much.
I got a problem with the CSS hover-event.
I created a page with a navigation bar at the top. For compatibility reasons I had to move away from nav and changed it to a simple div. (nav is not known in IE8, but it still has to be working there.)
<div class="nav">
<ul>
<li> <a> Something </a>
<ul>
....
</ul>
</li>
....
</ul>
</div>
That resulted in making the hover on my navigation bar not working anymore. But it's not, that nothing is working, only the first one of the following lines does not do it's job anymore. The background simply does not change.
.nav ul li:hover { background: #BFBFBF; } - not working
.nav ul li:hover > a { color:#FFFFFF; } - working perfectly fine
.nav ul li:hover > ul { display:block; } - working perfect as well
.nav ul {
background: #404040;
list-style:none;
padding:0 20px;
margin: 0;
height: 30px;
text-align:left;
display:block;
}
I double checked basically everything I know, suspected or found, that could be the source of my issue, but I was yet unable to get it back working.
I tried using background-color instead of background, without success.
I want to do it without having to use anything besides HTML and CSS, which should be possible, since it worked, when I still was using the nav-element.
I am noob to css, maybe I'm missing some really simple detail.
Thanks in advance.
Rather than modifying the nav bar content, just try to change the animation for the thing which you are pointing at, I mean that rather than hovering the <li> component just make the text in it hovering
.nav a {
text-decoration: none;
color: #fff;
display: block;
padding-left: 15px;
border-bottom: 1px solid #888;
transition: .2s background-color;
}
.nav a:hover {
background-color: #005f5f;
}
.nav a.active {
background-color: #aaa;
color: #444;
cursor: default;
}
Try defining the <a> element and hovering it as the whole <li> won't hover with multiple overlapping CSS formats
See I created something in html. And your code is working.
Its good if you can paste your html
<head runat="server">
<title></title>
<style type="text/css">
.nav ul li:hover {
background: #BFBFBF;
}
.nav ul li:hover > a {
color: #FFFFFF;
}
.nav ul li:hover > ul {
display: block;
}
</style>
<nav class="nav">
<ul>
<li>
<a>Li 1</a>
</li>
<li>
<ul>
<li>Li 2
</li>
</ul>
</li>
<li>Li 3
</li>
</ul>
</nav>
I'm creating a horizontal navigation bar and would like to stylize it so that a thin line will appear right above the bar (please see example).
Nav Bar Example
As you can see there is a thin, gold line just above the red navigation bar. I would like to get a thin, black line just above my orange navigation bar.
My code looks like this:
(CSS)
nav {width:100%;display:block;}
nav ul {list-style-type:none;margin:0;padding:0;text-align:center;background-color:#c0872e}
nav li {display:inline-block;background-color:#c0872e;}
nav a {line-height:35px; color:white; padding:0 30px; font-size:22px; font-family:WindsorDemi.fog Cn; background-color:#c0872e;}
nav a:hover {text-decoration:none}
(HTML)
<div>
<ul>
<li>Home</li>
<li>Products</li>
</ul>
</div>
Please let me know how I can achieve this desired effect. Thank you!
You could accomplish this using a border:
nav ul {
border-top: 2px solid #000; /* Added */
list-style-type:none;
margin:0;
padding:0;
text-align:center;
background-color:#c0872e
}
Here's a JSFiddle to show you how it looks.
Hope this helps! Let me know if you have any questions.
Just do this (add border-top)
CSS
nav ul {
list-style-type:none;
margin:0;padding:0;
text-align:center;
background-color:#c0872e;
border-top: solid 1px #000; // Add this (adjust your needs)
}
First, we need to change your surrounding div to the nav element.
<nav>
<ul>
<li>Home</li>
<li>Products</li>
</ul>
</nav>
Then just add a border-top to the nav css.
nav {width:100%;display:block;border-top:4px solid #000;}
nav ul {list-style-type:none;margin:0;padding:0;text-align:center;background-color:#c0872e}
nav li {display:inline-block;background-color:#c0872e;}
nav a {line-height:35px; color:white; padding:0 30px; font-size:22px; font-family:WindsorDemi.fog Cn; background-color:#c0872e;}
nav a:hover {text-decoration:none}
I am modifying the CSS of an existing web page. The navigation menu is in the form of a list in which the items have a certain background color under normal circumstances and another color when active or hovered-over. The CSS code for this is as follows:
#navigation li a:hover,
#navigation li#active a {
background: #104E91;
}
Some of the menu items (list items, in this case) have drop-down menus with links to sub-pages. I'm trying to make the navigation menu items have the "active" background color not only if they are themselves active, but also if one of their sub-pages is open. Is there any way to implement this? The code for the drop-down menus looks as follows:
#wsite-menus .wsite-menu li:first-child {
border-top: 1px solid #000;
}
#wsite-menus .wsite-menu li a {
padding: 8px;
color: #fff;
background: #2f2f2f;
border: 1px solid #4b4b4b;
border-top: none;
}
#wsite-menus .wsite-menu li a:hover {
background: #4b4b4b;
}
I suspect that the way to bring this about would be to modify the first of the two above blocks of code to read as follows:
#navigation li a:hover,
**#navigation li#active child,**
#navigation li#active a {
background: #104E91;
}
or something similar, but I can't figure out the exact syntax. Is there a way an open child page can make the parent page look active in the navigation menu?
The HTML is as follows:
<div id = "navigation">
<ul class = "wsite-menu-default">
<span id = "Span1" class = "wsite-nav-handle"> style="display: inline;">
<li class="w-menu-item wsite-nav-0" style="position: relative;">
... and so on, there are a number of list items. I guess I should create a separate span that imparts an active background color to a list item, and, on each child page, put that span around the list item that is responsible for the page's parent's menu item.
You didn't show any HTML, so I made up some of my own. I didn't use your tags of the same reason.
HTML:
<nav>
<li>Home</li>
<a href="#">
<li>Dropdown
<div class="dropdown">
<div class="dropdown-inner">
<a>Menu</a>
<a>Number</a>
<a>3</a>
</div>
</li>
</a>
<li>About</li>
</nav>
CSS:
nav li {
list-style:none;
display:inline-block;
text-align:center;
background:#222;
color:#FFF;
width:100px;
padding:10px 20px
}
nav a {
text-decoration: none;
color:#FFF;
}
nav li div.dropdown {
display:block;
position:absolute
}
nav li div.dropdown .dropdown-inner {
right:20px; /* Equal to li padding Y */
width:100px; /* Equal to li width */
padding:10px 20px; /* Equal to li padding X */
background:#333;
top:10px;
position:relative
}
nav li span.dropdown a {
display:block;
}
Codepen: http://codepen.io/anon/pen/bzIGl
The problem you're having is because you're assigning the background color to the <a> tag instead of <li> tag. When you exit a parent <li> item and move down to a child <li> element, you've technically left the <a> and so the background color reverts correctly. If however you apply the background color to the <li> tag, rolling over any child list items will keep the active state on the parent <li> item.
I have created CSS menu bar for my webpage. But Left side border is not displaying when some one move mouse on "My Presentations" link. Currently "My Favorite" link is selected. Please notice Left side gray border is not displaying on "My Favorite" link. But when u move mouse on "Friend's Favorite" link then right side border in displaying on "My Favorite" link. I need to display left side border to.
Here is the link:-
jsFiddle Link
<ul class="menu" style="margin-top:20px;">
<li>Home</li>
<li>My Presentations</li>
<li class="current">My Favorite</li>
<li>Friend's Favorite</li>
<li>Most Viewed</li>
<li>Sync account</li>
</ul>
/* NAVBAR CSS START HERE */
.menu,.menu ul,.menu li,.menu a {margin: 0;padding: 0;border: none;outline: none;}
.menu {height: 30px;width: 759px;background: #3B5998;border:1px solid #e1e1e1; border-top-left-radius:5px;-moz-border-radius-topleft:5px; border-top-right-radius:5px;-moz-border-radius-topright:5px}
.menu li {position: relative;list-style: none;float: left;display: block;height: 30px;}
.menu ul { display: none;}
.menu li a{display: block;padding: 0 14px;line-height: 30px;text-decoration: none;font-family: Tahoma;font-weight: bold;font-size: 11px;color: #f9f9f9;border-left:1px solid #8698C0;}
.menu li:hover > a{ color: #9a9a9a; background:#fff; border-left:1px solid #ccc;}
.menu li a.first{border-left:0px; background:#ffvv00;}
.menu li.current a{border:0px; height:31px;color: #9a9a9a; background:#fff; margin-top:-3px; padding-top:3px; padding-bottom:4px;border-top-left-radius:5px;-moz-border-radius-topleft:5px; border-top-right-radius:5px;-moz-border-radius-topright:5px;}
.menu li:first-child a:hover{border-top-left-radius:5px;-moz-border-radius-topleft:5px; border-right:1px #ccc solid; margin-right:-1px;}
.menu li:last-child a{border-right: none; }
Did many changes to the code, it better to take look at the demo
New Demo
Note :
I am not sure, why you made your active element more taller than other elements, and they have some rounded edge. It looks odd