My navbar has five buttons. But button nr.5, which is a dropdown-menu with a login function, needs a width on 300 px; My CSS is for all my buttons, so how can I make the dropdown login box unique, with a width there is different from the others?
HTML
<li>
About Us
</li>
<li>
Contact
</li>
<li class="dropdown">
<a class="dropdown-toggle" data-close-others="false" data-delay="0" data-hover=
"dropdown" data-toggle="dropdown" href="#">Login <i class="fa fa-angle-down"></i>
</a>
<ul class="dropdown-menu">
<li>
<!--container start-->
<div class="login-bg">
<div class="container">
<div class="form-wrapper">
<form class="form-signin wow fadeInUp" action="index.html">
<h2 class="form-signin-heading">sign in now</h2>
<div class="login-wrap">
<input type="text" class="form-control" placeholder="User ID" autofocus>
<input type="password" class="form-control" placeholder="Password">
<label class="checkbox">
</label>
<button class="btn btn-lg btn-login btn-block" type="submit">Sign in</button>
</div>
</form>
</div>
</div>
</div>
<!--container end-->
</li>
</ul>
</li>
CSS:
a { color: #444e67 }
a:hover { color: #48cfad }
p { line-height: 22px }
/*header*/
.head-section { border-bottom: 1px solid #eee }
.head-section .navbar {
margin-bottom: 0;
}
.navbar-default { border: none }
.navbar-brand {
color: #bcc0cd;
font-size: 30px;
font-weight: 100;
line-height: 30px;
margin-top: 30px;
padding: 0;
}
.navbar-brand span { color: #48cfad }
.head-section .navbar-collapse ul.navbar-nav {
float: right;
margin-right: 0;
z-index: 199;
}
.head-section .navbar-default { background-color: #fff }
.head-section .nav li a,
.head-section .nav li.active ul.dropdown-menu li a {
color: #999;
font-size: 14px;
font-weight: 300;
background: none;
***/* I can change my width here, but that is for all buttons */***
}
ul.dropdown-menu { border: none }
.head-section .nav li a:hover,
.head-section .nav li a:focus,
.head-section .nav li.active a,
.head-section .nav li.active a:hover,
.head-section .nav li a.dropdown-toggle:hover,
.head-section .nav li a.dropdown-toggle:focus,
.head-section .nav li.active ul.dropdown-menu li a:hover,
.head-section .nav li.active ul.dropdown-menu li.active a {
color: #fff;
background-color: #48cfad;
-webkit-transition: all .3s ease;
-moz-transition: all .3s ease;
-ms-transition: all .3s ease;
-o-transition: all .3s ease;
transition: all .3s ease;
}
.head-section .navbar-default .navbar-nav > .open > a,
.head-section .navbar-default .navbar-nav > .open > a:hover,
.head-section .navbar-default .navbar-nav > .open > a:focus {
color: #fff;
background-color: #48cfad;
-webkit-transition: all .3s ease;
-moz-transition: all .3s ease;
-ms-transition: all .3s ease;
-o-transition: all .3s ease;
transition: all .3s ease;
}
.head-section .navbar { min-height: 85px }
.head-section .navbar-nav > li {
padding-bottom: 25px;
padding-top: 30px;
}
.head-section ul.navbar-nav li:last-child() { margin-left: 10px !important }
.head-section .navbar-nav > li > a {
padding-bottom: 5px;
padding-top: 5px;
border-radius: 3px;
-webkit-border-radius: 3px;
-moz-border-radius: 3px;
margin-left: 2px;
line-height: 30px;
-webkit-transition: all .3s ease;
-moz-transition: all .3s ease;
-ms-transition: all .3s ease;
-o-transition: all .3s ease;
transition: all .3s ease;
}
.dropdown-menu li a:hover { color: #fff !important }
.head-section .navbar-default .navbar-nav > .open > a .caret,
.navbar-default .nav li.dropdown > a:focus .caret {
border-top-color: #ffffff;
border-bottom-color: #ffffff;
-webkit-transition: all .3s ease;
-moz-transition: all .3s ease;
-ms-transition: all .3s ease;
-o-transition: all .3s ease;
transition: all .3s ease;
color: #fff;
}
.dropdown-menu { box-shadow: none }
.head-section .nav li .dropdown-menu {
margin-top: -5px;
padding: 0;
border-radius: 0px;
-webkit-border-radius: 0px;
-moz-border-radius: 0px;
}
.head-section .nav li .dropdown-menu li a {
line-height: 30px;
padding: 3px 12px;
border-bottom: 1px solid #F3E8E8;
}
Related
hi the dropdown content isalways shown.. but i want it only when dropbutton is clicked ..on clicking the button background toggles in and out but the links remain outside the menu permanentaly.. please see
i have also attached screenshot below ..to be more clear
navbar css
.header-nav {
background-color: rgba(0, , 6, 0.3);
border-bottom: 1px solid rgba(255, 255, 255, 0.3);
left: 0;
height: 80px;
position: fixed;
top: 0;
-webkit-transition: all 0.4s ease-in-out;
-moz-transition: all 0.4s ease-in-out;
-o-transition: all 0.4s ease-in-out;
transition: all 0.4s ease-in-out;
width: 100%;
z-index: 999;
}
.header-nav.bg-color {
background-color: #fff;
}
.header-nav.menu-bg {
height: 56px;
}
/* menu */
.navbar-brand {
color: #fff;
font-size: 36px;
font-weight: bold;
line-height: 80px;
padding: 0;
text-transform: capitalize;
}
.header-nav.menu-bg .navbar-brand {
line-height: 56px;
}
.navbar-brand:hover {
color: #fff;
}
.navbar-brand > img {
height: 80px;
-webkit-transition: height 0.4s ease-in-out;
-moz-transition: height 0.4s ease-in-out;
-o-transition: height 0.4s ease-in-out;
transition: height 0.4s ease-in-out;
}
.menu-bg .navbar-brand > img {
height: 56px;
}
.bg-color .main-menu .navbar-nav li a {
color: #000;
}
.main-menu .navbar-nav li a {
color: #22a265;
font-size: 16px;
padding: 30px 20px;
text-transform: uppercase;
-webkit-transition: all 0.4s ease-in-out;
-moz-transition: all 0.4s ease-in-out;
-o-transition: all 0.4s ease-in-out;
transition: all 0.4s ease-in-out;
}
.menu-bg .main-menu .navbar-nav li a {
padding: 18px 15px;
color: #222;
}
.menu-bg .main-menu .navbar-nav li a:hover {
color: #fafafa;
}
.main-menu .navbar-nav li a:focus {
background-color: transparent;
}
.main-menu .navbar-nav li a:hover, .main-menu .navbar-nav li a.active {
color: #fff;
background-color: #04b962;
}
.menu-bg {
background-color: #fff;
box-shadow: 0 2px 10px -1px rgba(87, 97, 100, 0.35);
}
a img.logo-color {
opacity: 0;
height: 0;
}
.menu-bg a img.logo-white {
opacity: 0;
height: 0;
}
.menu-bg a img.logo-color {
opacity: 1;
}
.main-menu .navbar-nav li a.menubgactive {
background-color: #f0f0f0;
}
.main-menu .navbar-nav li a.menubgactive:hover {
background-color: #04b962;
}
/* navbar-toggle responsive menu */
.navbar-toggle {
border: none;
background: transparent;
}
.navbar-toggle.collapsed .icon-bar {
background-color: #04b962;
}
.navbar-toggle .icon-bar {
background-color: #e91313;
}
.navbar-toggle:hover {
background: transparent;
}
.navbar-toggle .icon-bar {
width: 32px;
height: 4px;
-webkit-transition:all 0.2s ease 0s;
-moz-transition:all 0.2s ease 0s;
-ms-transition:all 0.2s ease 0s;
-o-transition:all 0.2s ease 0s;
transition:all 0.2s ease 0s;
}
.navbar-toggle .top-bar {
-moz-transform:rotate(45deg);
-webkit-transform:rotate(45deg);
-o-transform:rotate(45deg);
-ms-transform:rotate(45deg);
transform:rotate(45deg);
transform-origin: 10% 10%;
}
.navbar-toggle .middle-bar {
opacity: 0;
}
.navbar-toggle .bottom-bar {
-moz-transform:rotate(-45deg);
-webkit-transform:rotate(-45deg);
-o-transform:rotate(-45deg);
-ms-transform:rotate(-45deg);
transform:rotate(-45deg);
transform-origin: 10% 90%;
}
.navbar-toggle.collapsed .top-bar {
-moz-transform:rotate(0);
-webkit-transform:rotate(0);
-o-transform:rotate(0);
-ms-transform:rotate(0);
transform:rotate(0);
}
.navbar-toggle.collapsed .middle-bar {
opacity: 1;
}
.navbar-toggle.collapsed .bottom-bar {
-moz-transform:rotate(0);
-webkit-transform:rotate(0);
-o-transform:rotate(0);
-ms-transform:rotate(0);
transform:rotate(0);
}
.dropdown {
position: relative;
display: inline-block;
}
.dropdown-content {
display: none;
position: absolute;
background-color: #f1f1f1;
min-width: 160px;
box-shadow: 0px 8px 16px 0px rgba(0,0,0,0.2);
z-index: 1;
}
.dropdown-content a {
color: black;
padding: 12px 16px;
text-decoration: none;
display: block;
}
.dropdown-content a:hover {background-color: #ddd;}
.dropdown:hover .dropdown-content {display: block;}
.dropdown:hover .dropbtn {background-color: #3e8e41;}
i want to click on 'stock' to open further links but they are always open
menu html..
<li class="nav-item dropdown">
<a class="nav-link dropdown-toggle" id="navbarDropdownMenuLink-333" data-toggle="dropdown"
aria-haspopup="true" aria-expanded="false">Stock
</a>
<div class="dropdown-menu dropdown-default" aria-labelledby="navbarDropdownMenuLink"> </div>
<a class="dropdown-content " href="#">Pick list</a>
<a class="dropdown-item" href="#">Satt i lager</a>
<a class="dropdown-item" href="#">Telling</a>
</li>
If you want to only use css to do this, you would do something like this:
You would include:
display: none;
And in include:
element:hover {
display: block;
}
If you are using bootstrap css, then you can do this way
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script>
<link rel="stylesheet" href="pulse.css">
<link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/4.4.1/css/bootstrap.min.css" integrity="sha384-Vkoo8x4CGsO3+Hhxv8T/Q5PaXtkKtu6ug5TOeNV6gBiFeWPGFN9MuhOf23Q9Ifjh" crossorigin="anonymous">
<div class="dropdown">
<button class="btn btn-primary h-100 dropdown-toggle" data-toggle="dropdown">Menu</button>
<ul class="dropdown-menu">
<li class="dropdown-header">Primary</li>
<li class="dropdown-item">Home</li>
<li class="dropdown-item">Shop</li>
<li class="dropdown-item">Products</li>
<li class="dropdown-header">Secondary</li>
<li class="dropdown-item">About</li>
<li class="dropdown-item">Contact Us</li>
</ul>
</div>
<script src="https://code.jquery.com/jquery-3.4.1.slim.min.js" integrity="sha384-J6qa4849blE2+poT4WnyKhv5vZF5SrPo0iEjwBvKU7imGFAV0wwj1yYfoRSJoZ+n" crossorigin="anonymous"></script>
<script src="https://cdn.jsdelivr.net/npm/popper.js#1.16.0/dist/umd/popper.min.js" integrity="sha384-Q6E9RHvbIyZFJoft+2mJbHaEWldlvI9IOYy5n3zV9zzTtmI3UksdQRVvoxMfooAo" crossorigin="anonymous"></script>
<script src="https://stackpath.bootstrapcdn.com/bootstrap/4.4.1/js/bootstrap.min.js" integrity="sha384-wfSDF2E50Y2D1uUdj0O3uMBJnjuUD4Ih7YwaYd1iqfktj0Uod8GCExl3Og8ifwB6" crossorigin="anonymous"></script>
I really want my navbar to scale to the screen, as the screen gets smaller so does the font, as well as the image. Any help? Kinda like https://devmounta.in/ navbar, like the image scales as well as the text.
HTML:
<nav class="navbar navbar-default">
<div class="container-fluid">
<div class="navbar-header">
<button type="button" class="navbar-toggle" data-toggle="collapse" data-target="#myNavbar">
<span class="icon-bar"></span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
</button>
<div class="logo">
<a class="navbar-brand" href="#"><img src="css/images/logo.png"></a>
</div>
</div>
<div class="collapse navbar-collapse" id="myNavbar">
<ul class="nav navbar-nav navbar-right">
<li>About</li>
<li>Stats</li>
<li>Drivers</li>
<li>Contact</li>
<li id="btn">Pledge Now</li>
</ul>
</div>
</div>
</nav>
CSS:
.navbar-default {
background: 0 0;
border: none;
border-radius: 0;
margin-bottom: 0;
}
.container-fluid {
padding: 0;
width: 90%;
margin: 0 auto;
}
.navbar-brand, .navbar-nav li a {
line-height: 85px;
height: 85px;
padding-top: 0;
}
.navbar-default .navbar-brand {
color: #FFF;
font-family: 'Ubuntu', sans-serif;
font-weight: 500;
font-size: 28px;
text-transform: uppercase;
}
.navbar-default .navbar-nav>li>a {
color: #FFF;
font-size: 18px;
font-family: 'Ubuntu', sans-serif;
font-weight: 500;
position: relative;
text-decoration: none;
display: inline;
padding: 0;
margin-left: 15px;
margin-right: 15px;
text-transform: uppercase;
}
.logo {
width: auto;
height: 85px;
}
.logo img {
height: 45px;
line-height: 45px;
display: inline-block;
}
.navbar-default .navbar-nav > li > a:hover, .navbar-default .navbar-nav > li > a:focus {
color: #84CF96;
-webkit-transition: .5s ease;
-moz-transition: .5s ease;
-o-transition: .5s ease;
transition: .5s ease;
}
.navbar-default .navbar-nav a:before {
content: "";
position: absolute;
width: 100%;
height: 2px;
margin-bottom: -10px;
bottom: 0;
left: 0;
background-color: #84CF96;
visibility: hidden;
-webkit-transform: scaleX(0);
transform: scaleX(0);
-webkit-transition: all 0.3s ease-in-out 0s;
transition: all 0.3s ease-in-out 0s;
}
.navbar-default .navbar-nav a:hover:before {
visibility: visible;
-webkit-transform: scaleX(1);
transform: scaleX(1);
}
#btn a{
border: 1px solid #F5F5F5;
padding: 10px;
}
#btn a:hover:before {
visibility: hidden;
-webkit-transform: scaleX(1);
transform: scaleX(1);
}
#btn a:hover , #btn a:focus{
color: #FFF;
background-color: #84CF96;
border-color: #84CF96;
-webkit-transition: .5s ease;
-moz-transition: .5s ease;
-o-transition: .5s ease;
transition: .5s ease;
}
Mobile CSS:
/* Small Devices, Tablets */
#media only screen and (max-width : 768px) {
.navbar-default {
background-color: #84CF96;
}
.navbar-default .navbar-toggle {
border: 0;
float: left;
margin-top: 23.5px;
}
.navbar-default .navbar-toggle:focus, .navbar-default .navbar-toggle:hover {
background-color: #6AA678;
}
.navbar-default .navbar-toggle .icon-bar {
background-color: #FFF;
width: 25px;
height: 4px;
}
.navbar-default .navbar-brand {
float: right;
}
.navbar-nav {
margin: 0;
text-align: center;
}
.navbar-default .navbar-nav>li>a {
display: block;
border-bottom: 1px solid #6AA678;
margin: 0;
height: 60px;
line-height: 60px;
}
.navbar-default .navbar-nav > li > a:hover, .navbar-default .navbar-nav > li > a:focus {
color: #FFF;
-webkit-transition: .5s ease;
-moz-transition: .5s ease;
-o-transition: .5s ease;
transition: .5s ease;
}
.navbar-default .navbar-nav > li:hover, .navbar-default .navbar-nav > li:focus {
background-color: #6AA678;
-webkit-transition: .5s ease;
-moz-transition: .5s ease;
-o-transition: .5s ease;
transition: .5s ease;
}
#btn{
display: none;
}
.navbar-collapse.in {
overflow-y: visible;
margin-bottom: 20px;
padding: 0;
}
.navbar-default .navbar-collapse, .navbar-default .navbar-form {
border-color: #6AA678;
}
}
I'm not sure if this is gonna work in your case, but you can try changing your image width from "auto" to "100%" in your styles:
.logo {
width: 100%;
....
}
.logo img {
width: 100%;
...
}
This usually works for images, so probably will work within your nav.
Hope it helps!
I want to target strictly the menu when hovering. The Menu would change color and size but without affecting the li menu. How would I do that?
Note that this is suppose to be an accordion menu. The nav (sub) expands when hovering over Menu. I have spent a great deal of time but I cannot target the Menu without messing up the sub.
<nav id="menu_box">
<ul class="menu">
<li> Menu
<ul>
<li>sub</li>
<li>sub</li>
<li>sub</li>
</ul>
</li>
<li> Menu
<ul>
<li>sub</li>
<li>sub</li>
<li>sub</li>
</ul>
</li>
<li> Menu
<ul>
<li>sub</li>
<li>sub</li>
</ul>
</li>
</ul>
</nav>
here is the css:
https://jsfiddle.net/kgrxqL0k/1/
Maybe this:
.menu > li li a:hover {
color: pink;
}
#cssmenu,
#cssmenu ul,
#cssmenu ul li,
#cssmenu ul li a {
margin: 0;
padding: 0;
border: 0;
list-style: none;
line-height: 1;
display: block;
position: relative;
-webkit-box-sizing: border-box;
-moz-box-sizing: border-box;
box-sizing: border-box;
}
#cssmenu {
width: 220px;
font-family: Raleway, sans-serif;
color: #ffffff;
}
#cssmenu ul ul {
display: none;
}
#cssmenu > ul > li.active > ul {
display: block;
}
.align-right {
float: right;
}
#cssmenu > ul > li > a {
padding: 16px 22px;
cursor: pointer;
z-index: 2;
font-size: 16px;
text-decoration: none;
color: #ffffff;
-webkit-transition: color .2s ease;
-o-transition: color .2s ease;
transition: color .2s ease;
}
#cssmenu > ul > li > a:hover {
color: #d8f3f0;
}
#cssmenu ul > li.has-sub > a:after {
position: absolute;
right: 26px;
top: 19px;
z-index: 5;
display: block;
height: 10px;
width: 2px;
content: "";
-webkit-transition: all 0.1s ease-out;
-moz-transition: all 0.1s ease-out;
-ms-transition: all 0.1s ease-out;
-o-transition: all 0.1s ease-out;
transition: all 0.1s ease-out;
}
#cssmenu ul > li.has-sub > a:before {
position: absolute;
right: 22px;
top: 23px;
display: block;
width: 10px;
height: 2px;
content: "";
-webkit-transition: all 0.1s ease-out;
-moz-transition: all 0.1s ease-out;
-ms-transition: all 0.1s ease-out;
-o-transition: all 0.1s ease-out;
transition: all 0.1s ease-out;
}
#cssmenu ul > li.has-sub.open > a:after,
#cssmenu ul > li.has-sub.open > a:before {
-webkit-transform: rotate(45deg);
-moz-transform: rotate(45deg);
-ms-transform: rotate(45deg);
-o-transform: rotate(45deg);
transform: rotate(45deg);
}
#cssmenu ul ul li a {
padding: 14px 22px;
cursor: pointer;
z-index: 2;
font-size: 14px;
text-decoration: none;
color: #dddddd;
-webkit-transition: color .2s ease;
-o-transition: color .2s ease;
transition: color .2s ease;
}
#menu ul li:hover a {
color: pink;
}
#cssmenu ul ul ul li a {
padding-left: 32px;
}
#cssmenu ul ul li a:hover {
color: #ffffff;
}
#cssmenu ul ul > li.has-sub > a:after {
top: 16px;
right: 26px;
}
#cssmenu ul ul > li.has-sub > a:before {
top: 20px;
}
.menu {
margin: 0 auto;
padding: 0;
width: 350px;
}
.menu li {
list-style: none;
}
.menu li a {
display: table;
margin-top: 1px;
padding: 14px 10px;
width: 100%;
text-decoration: none;
text-align: left;
vertical-align: middle;
color: #ccc;
font-weight: 600;
font-size: 18px;
overflow: hidden;
-webkit-transition-property: background;
-webkit-transition-duration: 0.4s;
-webkit-transition-timing-function: ease-out;
transition-property: background;
transition-duration: 0.4s;
transition-timing-function: ease-out;
}
.menu > li:first-child a {
margin-top: 0;
}
.menu >li a:hover a:first-child {
font-size: 25px;
color: #547b16;
}
.menu li a:hover {
] -webkit-transition-property: background;
-webkit-transition-duration: 0.2s;
-webkit-transition-timing-function: ease-out;
transition-property: background;
transition-duration: 0.2s;
transition-timing-function: ease-out;
}
.menu li ul {
margin: 0;
padding: 0;
}
.menu li li a {
display: block;
margin-top: 0;
padding: 0 10px;
height: 0;
color: #1F3D39;
-webkit-transition-property: all;
-webkit-transition-duration: 0.5s;
-webkit-transition-timing-function: ease-out;
transition-property: all;
transition-duration: 0.5s;
transition-timing-function: ease-out;
}
.menu > li:hover li a {
display: table;
margin-top: 1px;
padding: 10px;
width: 100%;
height: 1em;
-webkit-transition-property: all;
-webkit-transition-duration: 0.3s;
-webkit-transition-timing-function: ease-out;
transition-property: all;
transition-duration: 0.3s;
transition-timing-function: ease-out;
}
.menu > li:hover li a:hover {
-webkit-transition-property: background;
-webkit-transition-duration: 0.2s;
-webkit-transition-timing-function: ease-out;
transition-property: background;
transition-duration: 0.2s;
transition-timing-function: ease-out;
}
.menu > li li a:hover {
color: pink;
}
<nav id="menu_box">
<ul class="menu">
<li> Menu
<ul>
<li>sub
</li>
<li>sub
</li>
<li>sub
</li>
</ul>
</li>
<li> Menu
<ul>
<li>sub
</li>
<li>sub
</li>
<li>sub
</li>
</ul>
</li>
<li> Menu
<ul>
<li>sub
</li>
<li>sub
</li>
</ul>
</li>
</ul>
</nav>
I've created a drop down menu with pure CSS and I've gotten it to a place that I like EXCEPT I want it to be "drop-up" not drop-down since the menu bar is going at the bottom of the layout. I can't figure out what to add or change to make it "drop-up," help please!!
The CSS I used:
#cssmenuf {
position: relative;
height: 50px;
background: #2b2f3a;
width: auto;
}
#cssmenuf ul {
list-style: none;
padding: 0;
margin: 0;
line-height: 1;
}
#cssmenuf > ul {
position: relative;
display: block;
background: #2b2f3a;
height: 32px;
width: 100%;
z-index: 500;
bottom:100%;
}
#cssmenuf > ul > li {
display: block;
position: relative;
float: left;
margin: 0;
padding: 0;
}
#cssmenuf ul li a {
display: block;
font-family: Helvetica, sans-serif;
text-decoration: none;
}
#cssmenuf > ul > li > a {
font-size: 12px;
font-weight: bold;
padding: 15px 20px;
color: #7a8189;
text-transform: uppercase;
-webkit-transition: color 0.25s ease-out;
-moz-transition: color 0.25s ease-out;
-ms-transition: color 0.25s ease-out;
-o-transition: color 0.25s ease-out;
transition: color 0.25s ease-out;
}
#cssmenuf > ul > li.has-subf > a {
padding-right: 25px;
}
#cssmenuf > ul > li:hover > a {
color: #ffffff;
}
#cssmenuf li.has-subf::after {
display: block;
content: '';
position: absolute;
width: 0;
height: 0;
}
#cssmenuf > ul > li.has-subf::after {
right: 10px;
top: 20px;
border: 5px solid transparent;
border-top-color: #7a8189;
}
#cssmenuf > ul > li:hover::after {
border-top-color: #ffffff;
}
#cssmenuf ul ul {
position: absolute;
left: -9999px;
top: 70px;
opacity: 0;
-webkit-transition: opacity .3s ease, top .25s ease;
-moz-transition: opacity .3s ease, top .25s ease;
-ms-transition: opacity .3s ease, top .25s ease;
-o-transition: opacity .3s ease, top .25s ease;
transition: opacity .3s ease, top .25s ease;
z-index: 1000;
}
#cssmenuf ul ul ul {
top: 37px;
padding-left: 5px;
}
#cssmenuf ul ul li {
position: relative;
}
#cssmenuf > ul > li:hover > ul {
left: auto;
top: 44px;
opacity: 1;
}
#cssmenuf ul ul li:hover > ul {
left: 170px;
top: 0;
opacity: 1;
}
#cssmenuf ul ul li a {
width: 130px;
border-bottom: 1px solid #eee;
padding: 10px 20px;
font-size: 12px;
color: #9ea2a5;
background: #fff;
-webkit-transition: all .35s ease;
-moz-transition: all .35s ease;
-ms-transition: all .35s ease;
-o-transition: all .35s ease;
transition: all .35s ease;
}
#cssmenuf ul ul li:hover > a {
background: #f6f6f6;
color: #8c9195;
}
#cssmenuf ul ul li:last-child > a,
#cssmenu ul ul li.last > a {
border-bottom: 0;
}
#cssmenuf ul ul li.has-subf::after {
border: 4px solid transparent;
border-left-color: #9ea2a5;
right: 10px;
top: 12px;
-moz-transition: all .2s ease;
-ms-transition: all .2s ease;
-o-transition: all .2s ease;
transition: all .2s ease;
-webkit-transition: -webkit-transform 0.2s ease, right 0.2s ease;
}
#cssmenuf ul ul li.has-subf:hover::after {
border-left-color: #fff;
right: -5px;
-webkit-transform: rotateY(180deg);
-ms-transform: rotateY(180deg);
-moz-transform: rotateY(180deg);
-o-transform: rotateY(180deg);
transform: rotateY(180deg);
}
HTML
<div id='cssmenuf'>
<ul>
<li class='active'><a href='index.html'>
<span>About Us</span></a>
</li>
<li class='active'><a href='#'>
<span>FAQ</span></a>
</li>
<li class='active'><a href='#'>
<span>Contact Us</span></a>
</li>
<li class='active'><a href='#'>
<span>Testimonial</span></a>
</li>
<li class='has-subf'><a href='#'><span>Share On</span></a>
<ul>
<li class='has-subf'><a href='#'>
<span>Facebook</span></a></li>
<li class='has-subf'><a href='#'>
<span>Google+</span></a></li>
<li class='has-subf'><a href='#'>
<span>linkedIn</span></a></li>
<li class='has-subf'><a href='#'>
<span>Twitter</span></a></li>
</ul></li>
</ul>
</div>
In "#cssmenuf ul ul" and "#cssmenuf > ul > li:hover > ul" you use "top" instead of "bottom" to position your element. Change "top: 70px;" to "bottom: 70px;" and "top: 44px;" to "bottom: 44px;" and it should work.
I want to fix this menu bar at the top of the page,so that when user scrolls down, the menu bar continues to appear and the content flows into it.I have tried acheive that by changing position from relative to absolute, but that doesn't worked.
Here is the Css
ul.dark_menu {
list-style: none;
padding: 5px 1px;
font-family: 'Segoe UI Light', 'Open Sans', Verdana, Arial, Helvetica, sans-serif;
font-weight: 200;
font-size: 16px;
letter-spacing: 0.01em;
font-smooth: always;
color: #000000;
line-height: 15px;
margin: auto;
width: 1068px;
position: relative;
background: #2B5797;
}/* Blog johanes djogzs.blogspot.com */
ul.dark_menu:after {
content: "";
clear: both;
display: block;
overflow: hidden;
visibility: hidden;
width: 0;
height: 0;}
ul.dark_menu li {
float: left;
position: relative;
margin: 1px;}
/* Blog johanes djogzs.blogspot.com */
ul.dark_menu li a, ul.dark_menu li a:link {
color: #fafafa;
text-decoration: none;
display: block;
padding: 8px 26px;
-webkit-transition: all 0.2s ease;
-moz-transition: all 0.2s ease;
-o-transition: all 0.2s ease;
-ms-transition: all 0.2s ease;
transition: all 0.2s ease;
}/* Blog johanes djogzs.blogspot.com */
ul.dark_menu li a:hover {
color: #fafafa;
-webkit-transition: all 0.5s ease;
-moz-transition: all 0.5s ease;
-o-transition: all 0.5s ease;
transition: all 0.5s ease;
}/* Blog johanes djogzs.blogspot.com */
ul.dark_menu li a.selected {
border-right: 1px solid #ddd;
text-transform: uppercase;
margin-left: 10px;
}
ul.dark_menu li a.selected, ul.dark_menu li a:active {
color: #fafafa;
-webkit-transition: all 0.5s ease;
-moz-transition: all 0.5s ease;
-o-transition: all 0.5s ease;
transition: all 0.5s ease;}
ul.dark_menu li ul {
display: none;
}/* Blog johanes djogzs.blogspot.com */
ul.dark_menu li ul:before {
content: " ";
position: absolute;
display: block;
z-index: 1500;
left: 0;
top: -10px;
height: 10px;
width: 100%;}
ul.dark_menu li ul {-webkit-transition: all 0.5s ease;
-moz-transition: all 0.5s ease;
-o-transition: all 0.5s ease;
transition: all 0.5s ease;top:55px;}
ul.dark_menu li:hover ul {
position: absolute;
display: block;
z-index: 1000;
box-shadow: 0 5px 10px rgba(0, 0, 0, 0.2);
left: 0;border-radius: 0px 0px 5px 5px;
top: 37px;
padding: 5px 0;
list-style: none;
background: #fff;
}/* Blog johanes djogzs.blogspot.com */
ul.dark_menu li ul li {
float: none;
margin:0px;}
ul.dark_menu li ul li:first-child {
margin:0px;
border-top: 0 none;}
ul.dark_menu li ul li:last-child {
border-bottom: 0 none;
}/* Blog johanes djogzs.blogspot.com */
ul.dark_menu [data-role="dropdown"] > a::before {
position: absolute;
content: "^";
display: block;
font-size: 15px;
left: 100%;
margin-left: -20px;
top: 10px;
-webkit-transform: rotate(180deg);
-moz-transform: rotate(180deg);
-ms-transform: rotate(180deg);
-o-transform: rotate(180deg);
transform: rotate(180deg);
}
ul.dark_menu li ul li a, ul.dark_menu li ul li a:link {
color: #222;
display: block;
background: transparent none;
padding: 10px 25px 10px 25px;
white-space: nowrap;}
ul.dark_menu li ul li a:hover {
background:#2D89EF;-moz-transition: all 0.1s ease-in-out;color:#fff;
-webkit-transition: all 0.1s ease-in-out;
}/* Blog johanes djogzs.blogspot.com */
.menujohanes{position:relative;}
#search input[type="text"]:hover {width:848px;}
#search input[type="text"] {
background: #fff url("http://3.bp.blogspot.com/-uYZni0pIn-E/T-xY2vVu_-I/AAAAAAAACUY/ZMfR3_BvRFE/s1600/SEARCH_32x32-32.png")no-repeat center left;
font-size: 13px;
color: #222;
width: 0px;
padding: 10px 0px 11px 35px;
z-index: 9;
border: 1px solid #fff;
-webkit-transition: all 0.5s ease-in-out;
-moz-transition: all 0.5s ease-in-out;
margin-bottom: -1px;
position: absolute;
top: 0px;
right:27px;}
ul.dark_menu li ul li ul li { display: none; }
ul.dark_menu li ul li:hover ul li { display: block;}
ul.dark_menu li ul li:hover ul { left: 100%; top: 0; }
and the html
<div class='menujohanes'>
<ul class='dark_menu'>
<li>
<a class='selected' expr:href='data:blog.homepageUrl' title='Home'>
Home
</a>
</li>
<li data-role='dropdown'>
<a href='#'>
Categories
</a>
<ul>
<li>
<a href='#'>
Funny Pictures
</a>
<ul>
<li><a href='#'>Funny Gifs</a></li>
<li><a href='#'>Funny Pictures :)</a></li>
</ul>
</li>
<li>
<a href='#'>
Entertainment
</a>
<ul>
<li><a href='#'>Celebrities Pictures</a></li>
</ul>
</li>
<li>
<a href='#'>
Sports
</a>
<ul>
<li><a href='#'>Soccer Photos</a></li>
<li><a href='#'>Cricket Stars</a></li>
<li><a href='#'>Famous Tennis Players Pictures</a></li>
<li><a href='#'>WWE Superstars</a></li>
</ul>
</li>
</ul>
</li>
</ul>
<form action='/search' id='search' method='get'>
<input name='q' placeholder='Search Somethings..' size='40' type='text'/>
</form>
</div>
Change the div that you want to stay fixed to:
position: fixed;
z-index: 100;
The z-index is there to make sure the content flows under it. This value can be any positive number as long as its greater than any other element that you want to flow under it.
Hope this helps!
in your case make ul.dark_menu position:fixed;