Bootstrap Auto-Scaling Navigation Bar - html

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!

Related

css dropdown menu link are always outside the menu ..not toggling when button is clicked

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>

Upgrading to bootstrap 4, menu doesn't hide

I'm trying to upgrade my entire project from bootstrap 3.3.0 to bootstrap 4.0.0, but an important element isn't shown as it should, a side menu.
This is the basic code of the menu:
$(document).ready(function() {
var trigger = $('.hamburger'),
overlay = $('.overlay'),
isClosed = false;
trigger.click(function() {
hamburger_cross();
});
function hamburger_cross() {
if (isClosed == true) {
overlay.hide();
trigger.removeClass('is-open');
trigger.addClass('is-closed');
isClosed = false;
} else {
overlay.show();
trigger.removeClass('is-closed');
trigger.addClass('is-open');
isClosed = true;
}
}
$('[data-toggle="offcanvas"]').click(function() {
$('#wrapper').toggleClass('toggled');
});
});
body {
position: relative;
overflow-x: hidden;
}
body,
html {
height: 100%;
}
.nav .open>a,
.nav .open>a:hover,
.nav .open>a:focus {
background-color: transparent;
}
/*-------------------------------*/
/* Wrappers */
/*-------------------------------*/
#wrapper {
padding-left: 0;
-webkit-transition: all 0.5s ease;
-moz-transition: all 0.5s ease;
-o-transition: all 0.5s ease;
transition: all 0.5s ease;
}
#wrapper.toggled {
padding-left: 220px;
}
#sidebar-wrapper {
z-index: 1000;
left: 220px;
width: 0;
height: 100%;
margin-left: -220px;
overflow-y: auto;
overflow-x: hidden;
background: #1a1a1a;
-webkit-transition: all 0.5s ease;
-moz-transition: all 0.5s ease;
-o-transition: all 0.5s ease;
transition: all 0.5s ease;
}
#sidebar-wrapper::-webkit-scrollbar {
display: none;
}
#wrapper.toggled #sidebar-wrapper {
width: 220px;
}
#page-content-wrapper {
width: 100%;
padding-top: 70px;
}
#wrapper.toggled #page-content-wrapper {
position: absolute;
margin-right: -220px;
}
/*-------------------------------*/
/* Sidebar nav styles */
/*-------------------------------*/
.sidebar-nav {
position: absolute;
top: 0;
width: 220px;
margin: 0;
padding: 0;
list-style: none;
}
.sidebar-nav li {
position: relative;
line-height: 20px;
display: inline-block;
width: 100%;
}
.sidebar-nav li:before {
content: '';
position: absolute;
top: 0;
left: 0;
z-index: -1;
height: 100%;
width: 3px;
background-color: #1c1c1c;
-webkit-transition: width .2s ease-in;
-moz-transition: width .2s ease-in;
-ms-transition: width .2s ease-in;
transition: width .2s ease-in;
}
.sidebar-nav li:first-child a {
color: #fff;
background-color: #1a1a1a;
}
.sidebar-nav li:nth-child(2):before {
background-color: #ec1b5a;
}
.sidebar-nav li:nth-child(3):before {
background-color: #79aefe;
}
.sidebar-nav li:nth-child(4):before {
background-color: #314190;
}
.sidebar-nav li:nth-child(5):before {
background-color: #279636;
}
.sidebar-nav li:nth-child(6):before {
background-color: #7d5d81;
}
.sidebar-nav li:nth-child(7):before {
background-color: #ead24c;
}
.sidebar-nav li:nth-child(8):before {
background-color: #2d2366;
}
.sidebar-nav li:nth-child(9):before {
background-color: #35acdf;
}
.sidebar-nav li:hover:before,
.sidebar-nav li.open:hover:before {
width: 100%;
-webkit-transition: width .2s ease-in;
-moz-transition: width .2s ease-in;
-ms-transition: width .2s ease-in;
transition: width .2s ease-in;
}
.sidebar-nav li a {
display: block;
color: #ddd;
text-decoration: none;
padding: 10px 15px 10px 30px;
}
.sidebar-nav li a:hover,
.sidebar-nav li a:active,
.sidebar-nav li a:focus,
.sidebar-nav li.open a:hover,
.sidebar-nav li.open a:active,
.sidebar-nav li.open a:focus {
color: #fff;
text-decoration: none;
background-color: transparent;
}
.sidebar-nav>.sidebar-brand {
height: 65px;
font-size: 20px;
line-height: 44px;
}
.sidebar-nav .dropdown-menu {
position: relative;
width: 100%;
padding: 0;
margin: 0;
border-radius: 0;
border: none;
background-color: #222;
box-shadow: none;
}
/*-------------------------------*/
/* Hamburger-Cross */
/*-------------------------------*/
.hamburger {
position: fixed;
top: 20px;
z-index: 999;
display: block;
width: 32px;
height: 32px;
margin-left: 15px;
background: transparent;
border: none;
}
.hamburger:hover,
.hamburger:focus,
.hamburger:active {
outline: none;
}
.hamburger.is-closed:before {
content: '';
display: block;
width: 100px;
font-size: 14px;
color: #fff;
line-height: 32px;
text-align: center;
opacity: 0;
-webkit-transform: translate3d(0, 0, 0);
-webkit-transition: all .35s ease-in-out;
}
.hamburger.is-closed:hover:before {
opacity: 1;
display: block;
-webkit-transform: translate3d(-100px, 0, 0);
-webkit-transition: all .35s ease-in-out;
}
.hamburger.is-closed .hamb-top,
.hamburger.is-closed .hamb-middle,
.hamburger.is-closed .hamb-bottom,
.hamburger.is-open .hamb-top,
.hamburger.is-open .hamb-middle,
.hamburger.is-open .hamb-bottom {
position: absolute;
left: 0;
height: 4px;
width: 100%;
}
.hamburger.is-closed .hamb-top,
.hamburger.is-closed .hamb-middle,
.hamburger.is-closed .hamb-bottom {
background-color: #1a1a1a;
}
.hamburger.is-closed .hamb-top {
top: 5px;
-webkit-transition: all .35s ease-in-out;
}
.hamburger.is-closed .hamb-middle {
top: 50%;
margin-top: -2px;
}
.hamburger.is-closed .hamb-bottom {
bottom: 5px;
-webkit-transition: all .35s ease-in-out;
}
.hamburger.is-closed:hover .hamb-top {
top: 0;
-webkit-transition: all .35s ease-in-out;
}
.hamburger.is-closed:hover .hamb-bottom {
bottom: 0;
-webkit-transition: all .35s ease-in-out;
}
.hamburger.is-open .hamb-top,
.hamburger.is-open .hamb-middle,
.hamburger.is-open .hamb-bottom {
background-color: #1a1a1a;
}
.hamburger.is-open .hamb-top,
.hamburger.is-open .hamb-bottom {
top: 50%;
margin-top: -2px;
}
.hamburger.is-open .hamb-top {
-webkit-transform: rotate(45deg);
-webkit-transition: -webkit-transform .2s cubic-bezier(.73, 1, .28, .08);
}
.hamburger.is-open .hamb-middle {
display: none;
}
.hamburger.is-open .hamb-bottom {
-webkit-transform: rotate(-45deg);
-webkit-transition: -webkit-transform .2s cubic-bezier(.73, 1, .28, .08);
}
.hamburger.is-open:before {
content: '';
display: block;
width: 100px;
font-size: 14px;
color: #fff;
line-height: 32px;
text-align: center;
opacity: 0;
-webkit-transform: translate3d(0, 0, 0);
-webkit-transition: all .35s ease-in-out;
}
.hamburger.is-open:hover:before {
opacity: 1;
display: block;
-webkit-transform: translate3d(-100px, 0, 0);
-webkit-transition: all .35s ease-in-out;
}
/*-------------------------------*/
/* Overlay */
/*-------------------------------*/
.overlay {
position: fixed;
display: none;
width: 100%;
height: 100%;
top: 0;
left: 0;
right: 0;
bottom: 0;
background-color: rgba(250, 250, 250, .8);
z-index: 1;
}
<head>
<meta charset="utf-8">
<meta name="robots" content="noindex, nofollow">
<title>loleo</title>
<meta name="viewport" content="width=device-width, initial-scale=1">
<link href="http://maxcdn.bootstrapcdn.com/bootstrap/4.0.0/css/bootstrap.min.css" rel="stylesheet" id="bootstrap-css">
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
<!DOCTYPE html>
<html lang="en">
<script src="http://maxcdn.bootstrapcdn.com/bootstrap/4.0.0/js/bootstrap.min.js"></script>
<script src="http://code.jquery.com/jquery-1.11.1.min.js"></script>
<!--NO TOCAR-->
<script src="sidebar.js"></script>
<link rel="stylesheet" type="text/css" href="signup.css">
<link href="sidebar.css" rel="stylesheet" id="bootstrap-css">
</head>
<body>
<div id="wrapper">
<div class="overlay"></div>
<!-- SIDEBAR -->
<nav class="navbar navbar-dark bg-dark fixed-top navbar-expand-md" id="sidebar-wrapper" role="navigation">
<ul class="nav sidebar-nav">
<li class="sidebar-brand nav-item"> <a href="#" class="nav-link">
LOGO
</a>
</li>
<li class="nav-item"> READ
</li>
<li class="nav-item"> HISTORY
</li>
<li class="nav-item"> NOTIFICATIONS
</li>
<li class="dropdown nav-item"> CONFIG<span class="caret"></span>
<ul class="dropdown-menu" role="menu">
<li class="dropdown-item">PROFILE
</li>
<li class="dropdown-item">PREMIUM
</li>
<li class="dropdown-item">LOG OUT
</li>
</ul>
</li>
</ul>
</nav>
<!-- FIN DEL SIDEBAR -->
<!-- INICIO DEL BODY -->
<div id="page-content-wrapper">
<button type="button" class="hamburger is-closed" data-toggle="offcanvas"> <span class="hamb-top"></span>
<span class="hamb-middle"></span>
<span class="hamb-bottom"></span>
</button>
<!--modificable desde aquí-->
<!--hasta aquí-->
</div>
<!-- z -->
</div>
</body>
</html>
So, as you might have guessed, the menu should disappear totally when it's closed. I think a class is wrong, I have tried to change some of them, but don't know which one. Any idea?
I've finally found the problem.
in
<nav class="navbar navbar-dark bg-dark fixed-top navbar-expand-md" id="sidebar-wrapper" role="navigation">
It's useless writting the "navbar" class of the css, it is superimposing, so "there are two sidebars". Just deleted this class from the label and finished.

Cannot make Nav Horizontal

I've been working on this for ages and am trying everything under the sun to try to figure out how to make this navbar horizontal I've previously done it because I copied and pasted this from an old website I've done but it doesn't seem to be working. what am I doing wrong? Ive done floating to the left display inline all that stuff. is it possible that I have something that could be overriding it?
PS. I'm working in Dreamweaver and using some of the bootstrap codings if that helps.
<nav class="navbar" role="navigation">
<ul class="nav navbar-nav">
<li>home</li>
<li>menu</li>
<li>about</li>
<li>webshop</li>
</ul>
</nav>
/Nav Formatting/
.navbar-nav {
width: 20%;
text-align: center;
}
.navbar-nav > li {
float: right;
display: inline-block;
}
.navbar-nav .nav > lu {
float: right;
display: inline;
}
/Nav Formatting: Hover animation/
.navbar-nav li {
position: relative;
float: left;
margin: 0 20px;
}
.navbar-nav li:before {
content: '';
display: inline;
position: absolute;
bottom: 0;
left: 0;
width: 2px;
height: 0;
background-color: #ABE1DB;
-webkit-transition: height 0.4s ease 0.4s;
transition: height 0.4s ease 0.4s;
}
.navbar-nav li:after {
content: '';
display: inline;
position: absolute;
top: 0;
right: 0;
width: 2px;
height: 0;
background-color: #ABE1DB;
-webkit-transition: height 0.4s ease 0.4s;
transition: height 0.4s ease 0.4s;
}
.navbar-nav li:hover:before, li:hover:after {
height: 100%;
}
.navbar-nav li:hover a {
background-color: transparent;
-webkit-transition: background-color 0.4s ease 0.4s;
transition: background-color 0.4s ease 0.4s;
}
.navbar-nav li:hover a:before, li:hover a:after {
width: 100%;
}
.navbar-nav a {
display: inline;
padding: 0 40px;
height: 100%;
font-weight:normal;
font-size: 18px;
line-height: 60px;
color: #ABE1DB;
text-decoration: none;
-webkit-transition: background-color 0.4s ease;
transition: background-color 0.4s ease;
}
.navbar-nav a:before {
content: '';
display: inline;
position: absolute;
top: 0;
left: 0;
width: 0;
height: 2px;
background-color: #ABE1DB;
-webkit-transition: width 0.4s ease;
transition: width 0.4s ease;
}
.navbar-nav a:after {
content: '';
display: inline;
position: absolute;
bottom: 0;
right: 0;
width: 0;
height: 2px;
background-color: #ABE1DB;
-webkit-transition: width 0.4s ease;
transition: width 0.4s ease;
}
You have set
.navbar-nav{
width: 20%;
}
How can it expand? Try
.navbar-nav {
width: 100%;
}
/*Nav Formatting*/
.navbar-nav {
width: 100%;
text-align: center;
}
.navbar-nav>li {
float: right;
display: inline-block;
}
.navbar-nav .nav>lu {
float: right;
display: inline;
}
/*Nav Formatting: Hover animation*/
.navbar-nav li {
position: relative;
float: left;
margin: 0 20px;
}
.navbar-nav li:before {
content: '';
display: inline;
position: absolute;
bottom: 0;
left: 0;
width: 2px;
height: 0;
background-color: #ABE1DB;
-webkit-transition: height 0.4s ease 0.4s;
transition: height 0.4s ease 0.4s;
}
.navbar-nav li:after {
content: '';
display: inline;
position: absolute;
top: 0;
right: 0;
width: 2px;
height: 0;
background-color: #ABE1DB;
-webkit-transition: height 0.4s ease 0.4s;
transition: height 0.4s ease 0.4s;
}
.navbar-nav li:hover:before,
li:hover:after {
height: 100%;
}
.navbar-nav li:hover a {
background-color: transparent;
-webkit-transition: background-color 0.4s ease 0.4s;
transition: background-color 0.4s ease 0.4s;
}
.navbar-nav li:hover a:before,
li:hover a:after {
width: 100%;
}
.navbar-nav a {
display: inline;
padding: 0 40px;
height: 100%;
font-weight: normal;
font-size: 18px;
line-height: 60px;
color: #ABE1DB;
text-decoration: none;
-webkit-transition: background-color 0.4s ease;
transition: background-color 0.4s ease;
}
.navbar-nav a:before {
content: '';
display: inline;
position: absolute;
top: 0;
left: 0;
width: 0;
height: 2px;
background-color: #ABE1DB;
-webkit-transition: width 0.4s ease;
transition: width 0.4s ease;
}
.navbar-nav a:after {
content: '';
display: inline;
position: absolute;
bottom: 0;
right: 0;
width: 0;
height: 2px;
background-color: #ABE1DB;
-webkit-transition: width 0.4s ease;
transition: width 0.4s ease;
}
<!--- Navbar --->
<nav class="navbar" role="navigation">
<ul class="nav navbar-nav">
<li>home</li>
<li>menu</li>
<li>about</li>
<li>webshop</li>
</ul>
</nav>
The outer container .navbar-nav was styled with 20% width. This forced the inner elements to wrap because there was not enough space. A width of 100% is not need here because <nav> is an block element.
If you only have 4 four inner elements, you can give them a width of 25% combined with floating left to stack them next to each other.
Add a clearfix class or overflow:hidden (quick and dirty!) to the outer container to make sure it visally wraps the inner elements.
Please see my updated code snippet for reference:
/*Nav Formatting*/
.navbar-nav {
}
.navbar-nav li {
width: 25%;
float: left;
padding: 0;
margin: 0;
list-style: none;
text-align: center;
}
.navbar-nav .nav > ul {
float: right;
display: inline;
margin: 0;
}
/*Nav Formatting: Hover animation*/
.navbar-nav li {
position: relative;
}
.navbar-nav li:before {
content: '';
display: inline;
position: absolute;
bottom: 0;
left: 0;
width: 2px;
height: 0;
background-color: #ABE1DB;
-webkit-transition: height 0.4s ease 0.4s;
transition: height 0.4s ease 0.4s;
}
.navbar-nav li:after {
content: '';
display: inline;
position: absolute;
top: 0;
right: 0;
width: 2px;
height: 0;
background-color: #ABE1DB;
-webkit-transition: height 0.4s ease 0.4s;
transition: height 0.4s ease 0.4s;
}
.navbar-nav li:hover:before,
li:hover:after {
height: 100%;
}
.navbar-nav li:hover a {
background-color: transparent;
-webkit-transition: background-color 0.4s ease 0.4s;
transition: background-color 0.4s ease 0.4s;
}
.navbar-nav li:hover a:before,
li:hover a:after {
width: 100%;
}
.navbar-nav a {
display: inline;
padding: 0 40px;
height: 100%;
font-weight: normal;
font-size: 18px;
line-height: 60px;
color: #ABE1DB;
text-decoration: none;
-webkit-transition: background-color 0.4s ease;
transition: background-color 0.4s ease;
}
.navbar-nav a:before {
content: '';
display: inline;
position: absolute;
top: 0;
left: 0;
width: 0;
height: 2px;
background-color: #ABE1DB;
-webkit-transition: width 0.4s ease;
transition: width 0.4s ease;
}
.navbar-nav a:after {
content: '';
display: inline;
position: absolute;
bottom: 0;
right: 0;
width: 0;
height: 2px;
background-color: #ABE1DB;
-webkit-transition: width 0.4s ease;
transition: width 0.4s ease;
}
<!--- Navbar --->
<nav class="navbar" role="navigation">
<ul class="nav navbar-nav">
<li>home</li>
<li>menu</li>
<li>about</li>
<li>webshop</li>
</ul>
</nav>
Your ul is to small. That's why it will press it together. Try
ul.nav.navbar-nav {
width:100%;
}
/*Nav Formatting*/
.navbar-nav {
width: 100%;
text-align: center;
}
.navbar-nav >li {
float: right;
}
.navbar-nav .nav > ul {
float: right;
}
/*Nav Formatting: Hover animation*/
.navbar-nav li {
position: relative;
margin: 0 20px;
}
.navbar-nav li:before {
content: '';
display: inline;
position: absolute;
bottom: 0;
left: 0;
width: 2px;
height: 0;
background-color: #ABE1DB;
-webkit-transition: height 0.4s ease 0.4s;
transition: height 0.4s ease 0.4s;
}
.navbar-nav li:after {
content: '';
display: inline;
position: absolute;
top: 0;
right: 0;
width: 2px;
height: 0;
background-color: #ABE1DB;
-webkit-transition: height 0.4s ease 0.4s;
transition: height 0.4s ease 0.4s;
}
.navbar-nav li:hover:before,
li:hover:after {
height: 100%;
}
.navbar-nav li:hover a {
background-color: transparent;
-webkit-transition: background-color 0.4s ease 0.4s;
transition: background-color 0.4s ease 0.4s;
}
.navbar-nav li:hover a:before,
li:hover a:after {
width: 100%;
}
.navbar-nav a {
display: inline;
padding: 0 40px;
height: 100%;
font-weight: normal;
font-size: 18px;
line-height: 60px;
color: #ABE1DB;
text-decoration: none;
-webkit-transition: background-color 0.4s ease;
transition: background-color 0.4s ease;
}
.navbar-nav a:before {
content: '';
display: inline;
position: absolute;
top: 0;
left: 0;
width: 0;
height: 2px;
background-color: #ABE1DB;
-webkit-transition: width 0.4s ease;
transition: width 0.4s ease;
}
.navbar-nav a:after {
content: '';
display: inline;
position: absolute;
bottom: 0;
right: 0;
width: 0;
height: 2px;
background-color: #ABE1DB;
-webkit-transition: width 0.4s ease;
transition: width 0.4s ease;
}
<!--- Navbar --->
<nav class="navbar" role="navigation">
<ul class="nav navbar-nav">
<li>home</li>
<li>menu</li>
<li>about</li>
<li>webshop</li>
</ul>
</nav>

Order Progress bar is broken when bootstrap is applied

I am trying to use this progress step wizard and it works fine but when i try to add the bootstrap css everything messes up and i dont know what is what is wrong.
Here is a js fiddle
https://jsfiddle.net/gy2gqns1/
.step-wizard {
display: inline-block;
position: relative;
width: 100%;
}
.step-wizard .swprogress {
position: absolute;
top: 43px;
left: 12.5%;
width: 75%;
}
.step-wizard .swprogressbar {
position: absolute;
background-color: #0aa89e;
opacity: 0.4;
height: 12px;
border: 1px solid e5e6e6;
width: 0%;
-webkit-transition: width 0.6s ease;
-o-transition: width 0.6s ease;
transition: width 0.6s ease;
}
.step-wizard .swprogressbar.swempty {
opacity: 1;
width: 100%;
background-color: #e5e6e6;
}
.step-wizard ul {
position: absolute;
width: 100%;
list-style-type: none;
padding: 0;
left: -2%;
}
.step-wizard li {
display: inline-block;
text-align: center;
width: 24.7%;
}
.step-wizard li .swstep {
position: absolute;
display: inline-block;
line-height: 30px;
width: 30px;
height: 30px;
border-radius: 50%;
border: 4px solid;
border-color: #e5e6e6;
background: #ffffff;
-webkit-transition: background-color 0.6s ease, border-color 0.6s ease;
-o-transition: background-color 0.6s ease, border-color 0.6s ease;
transition: background-color 0.6s ease, border-color 0.6s ease;
}
.step-wizard li .swtitle {
position: absolute;
width: 100%;
left: 20px;
padding-top: 42px;
color: #969c9c;
-webkit-transition: color 0.6s ease;
-o-transition: color 0.6s ease;
transition: color 0.6s ease;
}
.step-wizard li.swactive .swstep {
border-color: #0aa89e;
}
.step-wizard li.swactive .swtitle {
color: black;
}
.step-wizard li.swdone .swstep {
color: white;
background-color: #0aa89e;
border-color: #0aa89e;
}
.step-wizard li > a {
display: block;
width: 100%;
color: black;
position: relative;
text-align: center;
}
.step-wizard li > a:hover .swstep {
border-color: #0aa89eg;
}
.step-wizard li > a:hover .swtitle {
color: black;
}
#media only screen and (max-width: 1200px) {
.step-wizard li {
width: 24%;
}
}
#media only screen and (max-width: 375px) {
.step-wizard li {
width: 22%;
}
}
<body>
<div id="container">
<div class="step-wizard">
<div class="swprogress">
<div class="swprogressbar swempty"></div>
<div id="prog" class="swprogressbar" style="width:33.3%"></div>
</div>
<ul>
<li class="swactive">
<a href="#" id="step1">
<span class="swstep">1</span>
<span class="swtitle">Client Details</span>
</a>
</li>
<li class="swactive">
<a href="#" id="step2">
<span class="swstep">2</span>
<span class="swtitle">Brand Details</span>
</a>
</li>
<li class="">
<a href="#" id="step3">
<span class="swstep">3</span>
<span class="swtitle">Shift Details</span>
</a>
</li>
<li class="">
<a href="#" id="step4">
<span class="swstep">4</span>
<span class="swtitle">Confirmation</span>
</a>
</li>
</ul>
</div>
</div>
Bootstrap adding son styling to ul ad other that override your style.
With little correction to your style you can correct the modify by bs:
.step-wizard {
display: inline-block;
position: relative;
width: 100%;
}
.step-wizard .swprogress {
position: absolute;
top: 43px;
left: 12.5%;
width: 75%;
}
.step-wizard .swprogressbar {
position: absolute;
background-color: #0aa89e;
opacity: 0.4;
height: 12px;
border: 1px solid e5e6e6;
width: 0%;
-webkit-transition: width 0.6s ease;
-o-transition: width 0.6s ease;
transition: width 0.6s ease;
}
.step-wizard .swprogressbar.swempty {
opacity: 1;
width: 100%;
background-color: #e5e6e6;
}
.step-wizard ul {
position: absolute;
width: 100%;
list-style-type: none;
padding: 0;
left: -2%;
margin-top:16px; /* Style correction */
}
.step-wizard li {
display: inline-block;
text-align: center;
width: 24.7%;
}
.step-wizard li .swstep {
position: absolute;
display: inline-block;
line-height: 30px;
width: 38px; /* Style correction */
height: 38px; /* Style correction */
border-radius: 50%;
border: 4px solid;
border-color: #e5e6e6;
background: #ffffff;
-webkit-transition: background-color 0.6s ease, border-color 0.6s ease;
-o-transition: background-color 0.6s ease, border-color 0.6s ease;
transition: background-color 0.6s ease, border-color 0.6s ease;
}
.step-wizard li .swtitle {
position: absolute;
width: 100%;
left: 20px;
padding-top: 42px;
color: #969c9c;
-webkit-transition: color 0.6s ease;
-o-transition: color 0.6s ease;
transition: color 0.6s ease;
}
.step-wizard li.swactive .swstep {
border-color: #0aa89e;
}
.step-wizard li.swactive .swtitle {
color: black;
}
.step-wizard li.swdone .swstep {
color: white;
background-color: #0aa89e;
border-color: #0aa89e;
}
.step-wizard li > a {
display: block;
width: 100%;
color: black;
position: relative;
text-align: center;
}
.step-wizard li > a:hover .swstep {
border-color: #0aa89eg;
}
.step-wizard li > a:hover .swtitle {
color: black;
}
#media only screen and (max-width: 1200px) {
.step-wizard li {
width: 24%;
}
}
#media only screen and (max-width: 375px) {
.step-wizard li {
width: 22%;
}
}

unique width on navbar button

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;
}