Bootstrap collapse is hiding all links in a large viewport - html

I am trying to use the collapse function in Bootstrap after watching some tutorials I tried it out myself and I am left with no links showing on a large viewport.
Here is my code does anbody notice anything that might be wrong with it?
The HTML:
<nav class="navbar navbar-default affix-top nav-links" data-spy="affix" data-offset-top="100" role="navigation">
<div class="container">
<div class="navbar-header">
<a class="navbar-brand" href="/"><img src="media/img/nav-logo.png" alt="Driven Car Sales Logo" class="img-rounded logo-nav navbar-brand"></a>
</div>
<div class="nav-collapse collapse navbar-responsive-collapse">
<ul class="nav navbar-nav">
<li>Used Cars
</li>
<li>Get Finance
</li>
<li class="dropdown">About Driven<strong class="caret"></strong>
<ul class="dropdown-menu">
<li>
<a href"#">The Team</a>
</li>
<li>
<a href"#">Our Partners</a>
</li>
</ul> <!--Drop Down End-->
</li>
<li>How To Find Us
</li>
<li>Contact Us
</li>
</ul>
</div>
</div>
</nav>
The custom CSS:
.logo-nav {
height: 2.3em;
width: auto;
}
.brand {
font-size: 2em;
margin: 20px 0 25px;
}
.navbar-brand {
opacity: 0;
color: #ff0066;
-webkit-transition:opacity 0.3s ease-in;
-moz-transition:opacity 0.3s ease-in;
-o-transition:opacity 0.3s ease-in;
transition: opacity 0.3s ease-in;
margin-left: 0px;
}
.navbar {
border-radius: 0px;
border-left: none;
border-right: none;
}
.navbar-default .navbar-nav>.open>a, .navbar-default .navbar-nav>.open>a:hover, .navbar- default .navbar-nav>.open>a:focus {
color: #fff;
background-color: #DD3B4D;
}
.navbar-default .navbar-nav>li>a:hover, .navbar-default .navbar-nav>li>a:focus {
color: #fff;
}
.dropdown-menu {
color: #fff;
background-color: #DD3B4D;
}
.dropdown-menu>li>a {
color: #fff;
}
nav.affix {
top: 0;
width: 100%;
z-index: 1000;
}
nav.affix .navbar-brand {
opacity: 1;
height: 2.3em;
width: auto;
}
.navbar-header {
width: 0px;
-webkit-transition:width .4s ease-in-out;
-moz-transition:width .4s ease-in-out;
-o-transition:width .4s ease-in-out;
transition:width .4s ease-in-out;
margin: 0 1em 0 1em
}
nav.affix .navbar-header {
width: 8em;
-webkit-transition: width .4s ease-in-out;
-moz-transition: width .4s ease-in-out;
-o-transition: width .4s ease-in-out;
transition: width .4s ease-in-out;
margin: 0 1em 0 0;
}
.nav-links {
font: 600 15px/1.5 'Arimo';
}
.navbar-nav > li:last-child{
border-right: 1px solid #475d88;
}
ul.nav a:hover {
color: #fff !important;
background-color: #DD3B4D !important;
-webkit-transition: background-color 0.6s ease;
-moz-transition: background-color 0.6s ease;
-o-transition: background-color 0.6s ease;
transition: background-color 0.6s ease;
}
nav.affix .navbar-brand {
display: inline-block;
}
Sorry for the amount of CSS I didn't realise how much there was ha.
I have had a good play about and can't seem to stop this from happening.

Remove the collapse class
Link http://jsfiddle.net/LvhCh/1/
<div class="nav-collapse navbar-responsive-collapse" data-toggle="collapse" data-target=".navbar-nav">

Related

Bootstrap 4 navbar lost it's background during coding

I'm new to Boostrap, and in an attempt to make a navbar more responsive for all screens and add some effects somewhere along the way my navbar lost its background color.
I've tried explicitly taking the navbar-light class and changed it's colour, but it doesn't seem to work.
The HTML:
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8" />
<meta http-equiv="X-UA-Compatible" content="IE=edge" />
<title>
Navbar
</title>
<meta name="viewport" content="width=device-width, initial-scale=1" />
<link
rel="stylesheet"
href="https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0/css/bootstrap.min.css"
integrity="sha384-Gn5384xqQ1aoWXA+058RXPxPg6fy4IWvTNh0E263XmFcJlSAwiGgFAW/dAiS6JXm"
crossorigin="anonymous"
/>
<link rel="stylesheet" type="text/css" media="screen" href="main.css" />
<script src="main.js"></script>
</head>
<body>
<header class="header_area">
<div class="main_menu">
<nav class="navbar navbar-expand-lg navbar-light">
<div class="container box_1620">
<a class="navbar-brand logo_h" href="index.html"><h2>Brand</h2></a>
<button
class="navbar-toggler"
type="button"
data-toggle="collapse"
data-target="#navbarSupportedContent"
aria-controls="navbarSupportedContent"
aria-expanded="false"
aria-label="Toggle navigation"
>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
</button>
<div
class="collapse navbar-collapse offset"
id="navbarSupportedContent"
>
<ul class="nav navbar-nav menu_nav ml-auto">
<li class="nav-item active">
<a class="nav-link" href="index.html">Home</a>
</li>
<li class="nav-item">
<a class="nav-link" href="about.html">About Us</a>
</li>
<li class="nav-item">
<a class="nav-link" href="pricing.html">Pricing</a>
</li>
<li class="nav-item">
<a class="nav-link" href="gallery.html">Gallery</a>
</li>
<li class="nav-item">
<a class="nav-link" href="contact.html">Contact</a>
</li>
</ul>
</div>
</div>
</nav>
</div>
</header>
<script
src="https://code.jquery.com/jquery-3.2.1.slim.min.js"
integrity="sha384-KJ3o2DKtIkvYIK3UENzmM7KCkRr/rE9/Qpg6aAZGJwFDMVNA/GpGFF93hXpG5KkN"
crossorigin="anonymous"
></script>
<script
src="https://cdnjs.cloudflare.com/ajax/libs/popper.js/1.12.9/umd/popper.min.js"
integrity="sha384-ApNbgh9B+Y1QKtv3Rn7W3mgPxhU9K/ScQsAP7hUibX39j7fakFPskvXusvfa0b4Q"
crossorigin="anonymous"
></script>
<script
src="https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0/js/bootstrap.min.js"
integrity="sha384-JZR6Spejh4U02d8jOt6vLEHfe/JQGiRRSQQxSfFWpi1MquVdAyjUar5+76PVCmYl"
crossorigin="anonymous"
></script>
</body>
</html>
The CSS:
.header_area {
padding: 0px;
border: 0px;
border-width: 0px;
position: absolute;
width: 100%;
top: 0;
left: 0;
z-index: 99;
-webkit-transition: background 0.4s, all 0.3s linear;
-o-transition: background 0.4s, all 0.3s linear;
transition: background 0.4s, all 0.3s linear;
}
.header_area .navbar {
padding: 0px;
border: 0px;
border-width: 0px;
}
.header_area .navbar .nav .nav-item {
margin-right: 45px;
}
.header_area .navbar .nav .nav-item .nav-link {
font: 500 12px/100px "Roboto", sans-serif;
text-transform: uppercase;
color: #222222;
padding: 0px;
display: inline-block;
}
.header_area .navbar .nav .nav-item .nav-link:after {
display: none;
}
.header_area .navbar .nav .nav-item:hover .nav-link,
.header_area .navbar .nav .nav-item.active .nav-link {
color: #ff2f92;
}
.header_area .navbar .nav .nav-item.submenu {
position: relative;
}
.header_area .navbar .nav .nav-item.submenu ul {
border: none;
padding: 0px;
border-radius: 0px;
-webkit-box-shadow: none;
box-shadow: none;
margin: 0px;
background: #fff;
}
#media (min-width: 992px) {
.header_area .navbar .nav .nav-item.submenu ul {
position: absolute;
top: 120%;
left: 0px;
min-width: 200px;
text-align: left;
opacity: 0;
-webkit-transition: all 300ms ease-in;
-o-transition: all 300ms ease-in;
transition: all 300ms ease-in;
display: block;
border: none;
padding: 0px;
border-radius: 0px;
}
}
.header_area .navbar .nav .nav-item.submenu ul:before {
content: "";
width: 0;
height: 0;
border-style: solid;
border-color: #eeeeee transparent transparent transparent;
position: absolute;
right: 24px;
top: 45px;
z-index: 3;
opacity: 0;
-webkit-transition: all 400ms linear;
-o-transition: all 400ms linear;
transition: all 400ms linear;
}
.header_area .navbar .nav .nav-item.submenu ul .nav-item {
display: block;
float: none;
margin-right: 0px;
border-bottom: 1px solid #ededed;
margin-left: 0px;
-webkit-transition: all 0.4s linear;
-o-transition: all 0.4s linear;
transition: all 0.4s linear;
}
.header_area .navbar .nav .nav-item.submenu ul .nav-item .nav-link {
line-height: 45px;
color: #222222;
padding: 0px 30px;
-webkit-transition: all 150ms linear;
-o-transition: all 150ms linear;
transition: all 150ms linear;
display: block;
margin-right: 0px;
}
.header_area .navbar .nav .nav-item.submenu ul .nav-item:last-child {
border-bottom: none;
}
.header_area .navbar .nav .nav-item.submenu ul .nav-item:hover .nav-link {
background: #ff2f92;
color: #fff;
}
#media (min-width: 992px) {
.header_area .navbar .nav .nav-item.submenu:hover ul {
visibility: visible;
opacity: 1;
top: 100%;
}
}
.header_area .navbar .nav .nav-item.submenu:hover ul .nav-item {
margin-top: 0px;
}
.header_area .navbar .nav .nav-item:last-child {
margin-right: 0px;
}
.header_area + section,
.header_area + row,
.header_area + div {
margin-top: 100px;
}
.header_area.navbar_fixed .main_menu {
position: fixed;
width: 100%;
top: -70px;
left: 0;
right: 0;
background: #fff;
-webkit-transform: translateY(70px);
-ms-transform: translateY(70px);
transform: translateY(70px);
-webkit-transition: background 500ms ease, -webkit-transform 500ms ease;
transition: background 500ms ease, -webkit-transform 500ms ease;
-o-transition: transform 500ms ease, background 500ms ease;
transition: transform 500ms ease, background 500ms ease;
transition: transform 500ms ease, background 500ms ease,
-webkit-transform 500ms ease;
-webkit-transition: transform 500ms ease, background 500ms ease;
-webkit-box-shadow: 0px 3px 16px 0px rgba(0, 0, 0, 0.1);
box-shadow: 0px 3px 16px 0px rgba(0, 0, 0, 0.1);
}
I want to know why this happened, where I went wrong and a solution to my problem.
Your error is here:
<nav class="navbar navbar-expand-lg navbar-light">
In bootstrap 4 we use bg-light instead of navbar-light like below...
If you want another colors, check the documentation here: https://getbootstrap.com/docs/4.0/components/navbar/#color-schemes
.header_area {
padding: 0px;
border: 0px;
border-width: 0px;
position: absolute;
width: 100%;
top: 0;
left: 0;
z-index: 99;
-webkit-transition: background 0.4s, all 0.3s linear;
-o-transition: background 0.4s, all 0.3s linear;
transition: background 0.4s, all 0.3s linear;
}
.header_area .navbar {
padding: 0px;
border: 0px;
border-width: 0px;
}
.header_area .navbar .nav .nav-item {
margin-right: 45px;
}
.header_area .navbar .nav .nav-item .nav-link {
text-transform: uppercase;
color: #222222;
padding: 0px;
display: inline-block;
}
.header_area .navbar .nav .nav-item .nav-link:after {
display: none;
}
.header_area .navbar .nav .nav-item:hover .nav-link,
.header_area .navbar .nav .nav-item.active .nav-link {
color: #ff2f92;
}
.header_area .navbar .nav .nav-item.submenu {
position: relative;
}
.header_area .navbar .nav .nav-item.submenu ul {
border: none;
padding: 0px;
border-radius: 0px;
-webkit-box-shadow: none;
box-shadow: none;
margin: 0px;
background: #fff;
}
#media (min-width: 992px) {
.header_area .navbar .nav .nav-item.submenu ul {
position: absolute;
top: 120%;
left: 0px;
min-width: 200px;
text-align: left;
opacity: 0;
-webkit-transition: all 300ms ease-in;
-o-transition: all 300ms ease-in;
transition: all 300ms ease-in;
display: block;
border: none;
padding: 0px;
border-radius: 0px;
}
}
.header_area .navbar .nav .nav-item.submenu ul:before {
content: "";
width: 0;
height: 0;
border-style: solid;
border-color: #eeeeee transparent transparent transparent;
position: absolute;
right: 24px;
top: 45px;
z-index: 3;
opacity: 0;
-webkit-transition: all 400ms linear;
-o-transition: all 400ms linear;
transition: all 400ms linear;
}
.header_area .navbar .nav .nav-item.submenu ul .nav-item {
display: block;
float: none;
margin-right: 0px;
border-bottom: 1px solid #ededed;
margin-left: 0px;
-webkit-transition: all 0.4s linear;
-o-transition: all 0.4s linear;
transition: all 0.4s linear;
}
.header_area .navbar .nav .nav-item.submenu ul .nav-item .nav-link {
line-height: 45px;
color: #222222;
padding: 0px 30px;
-webkit-transition: all 150ms linear;
-o-transition: all 150ms linear;
transition: all 150ms linear;
display: block;
margin-right: 0px;
}
.header_area .navbar .nav .nav-item.submenu ul .nav-item:last-child {
border-bottom: none;
}
.header_area .navbar .nav .nav-item.submenu ul .nav-item:hover .nav-link {
background: #ff2f92;
color: #fff;
}
#media (min-width: 992px) {
.header_area .navbar .nav .nav-item.submenu:hover ul {
visibility: visible;
opacity: 1;
top: 100%;
}
}
.header_area .navbar .nav .nav-item.submenu:hover ul .nav-item {
margin-top: 0px;
}
.header_area .navbar .nav .nav-item:last-child {
margin-right: 0px;
}
.header_area + section,
.header_area + row,
.header_area + div {
margin-top: 100px;
}
.header_area.navbar_fixed .main_menu {
position: fixed;
width: 100%;
top: -70px;
left: 0;
right: 0;
background: #fff;
-webkit-transform: translateY(70px);
-ms-transform: translateY(70px);
transform: translateY(70px);
-webkit-transition: background 500ms ease, -webkit-transform 500ms ease;
transition: background 500ms ease, -webkit-transform 500ms ease;
-o-transition: transform 500ms ease, background 500ms ease;
transition: transform 500ms ease, background 500ms ease;
transition: transform 500ms ease, background 500ms ease,
-webkit-transform 500ms ease;
-webkit-transition: transform 500ms ease, background 500ms ease;
-webkit-box-shadow: 0px 3px 16px 0px rgba(0, 0, 0, 0.1);
box-shadow: 0px 3px 16px 0px rgba(0, 0, 0, 0.1);
}
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8" />
<meta http-equiv="X-UA-Compatible" content="IE=edge" />
<title>
Navbar
</title>
<meta name="viewport" content="width=device-width, initial-scale=1" />
<link
rel="stylesheet"
href="https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0/css/bootstrap.min.css"
integrity="sha384-Gn5384xqQ1aoWXA+058RXPxPg6fy4IWvTNh0E263XmFcJlSAwiGgFAW/dAiS6JXm"
crossorigin="anonymous"
/>
<link rel="stylesheet" type="text/css" media="screen" href="main.css" />
<script src="main.js"></script>
</head>
<body>
<header class="header_area">
<div class="main_menu">
<nav class="navbar navbar-expand-lg bg-light">
<div class="container box_1620">
<a class="navbar-brand logo_h" href="index.html"><h2>Brand</h2></a>
<button
class="navbar-toggler"
type="button"
data-toggle="collapse"
data-target="#navbarSupportedContent"
aria-controls="navbarSupportedContent"
aria-expanded="false"
aria-label="Toggle navigation"
>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
</button>
<div
class="collapse navbar-collapse offset"
id="navbarSupportedContent"
>
<ul class="nav navbar-nav menu_nav ml-auto">
<li class="nav-item active">
<a class="nav-link" href="index.html">Home</a>
</li>
<li class="nav-item">
<a class="nav-link" href="about.html">About Us</a>
</li>
<li class="nav-item">
<a class="nav-link" href="pricing.html">Pricing</a>
</li>
<li class="nav-item">
<a class="nav-link" href="gallery.html">Gallery</a>
</li>
<li class="nav-item">
<a class="nav-link" href="contact.html">Contact</a>
</li>
</ul>
</div>
</div>
</nav>
</div>
</header>
<script
src="https://code.jquery.com/jquery-3.2.1.slim.min.js"
integrity="sha384-KJ3o2DKtIkvYIK3UENzmM7KCkRr/rE9/Qpg6aAZGJwFDMVNA/GpGFF93hXpG5KkN"
crossorigin="anonymous"
></script>
<script
src="https://cdnjs.cloudflare.com/ajax/libs/popper.js/1.12.9/umd/popper.min.js"
integrity="sha384-ApNbgh9B+Y1QKtv3Rn7W3mgPxhU9K/ScQsAP7hUibX39j7fakFPskvXusvfa0b4Q"
crossorigin="anonymous"
></script>
<script
src="https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0/js/bootstrap.min.js"
integrity="sha384-JZR6Spejh4U02d8jOt6vLEHfe/JQGiRRSQQxSfFWpi1MquVdAyjUar5+76PVCmYl"
crossorigin="anonymous"
></script>
</body>
</html>
The problem about the huge navbar is here:
.header_area .navbar .nav .nav-item .nav-link {
font: 500 12px/100px "Roboto", sans-serif;
text-transform: uppercase;
color: #222222;
padding: 0px;
display: inline-block;
}
What's doing that is the line:
font: 500 12px/100px "Roboto", sans-serif;
You have to put a smaller font, or just delete it and it'll do the trick!

Footer content not floating to right

I have a footer with content in it. Problem I'm having is the content is displaying vertically instead of horizontally.
I've tried using float:right; that hasn't changed anything. Would really appreciate some help.
Also two of the three social icons aren't showing up. That might be because of the float issue though...
Here's my code
<div class="footer-grid">
<h3>More</h3>
<ul>
<li>FAQ</li>
<li>Privacy Policy</li>
<li>Terms and Conditions</li>
</ul>
</div>
<div class="footer-grid">
<h3>Connect With Us</h3>
<ul class="social-icons">
<li>
<a class="facebook" href="#"> </a>
</li>
<li>
<a class="pinterest" href="#"> </a>
</li>
<li>
<a class="twitter" href="#"> </a>
</li>
</ul>
<p class="copy-right">Website by Elevate design</p>
</div>
Css:
.footer-grid {
min-width: 100%;
float: left;
background-color: #414141;
}
.footer-grid:nth-child(3n+1) {
margin-right: 0;
}
.footer-grid h3 {
color: #3D3D3D;
float: right;
font-size: 14px;
font-family: 'arial';
margin-bottom: 0.8em;
}
.footer-grid ul li {}
.footer-grid ul li a {
color: #8C8C8C;
font-size: 14px;
transition: 0.5s all;
margin-right: 10px;
-webkit-transition: 0.5s all;
-moz-transition: 0.5s all;
-o-transition: 0.5s all;
}
.footer-grid ul li a:hover {
zoom: 1;
filter: alpha(opacity=75);
opacity: 0.7;
-webkit-transition: opacity .15s ease-in-out;
-moz-transition: opacity .15s ease-in-out;
-ms-transition: opacity .15s ease-in-out;
-o-transition: opacity .15s ease-in-out;
transition: opacity .15s ease-in-out;
}
.social-icons li {
display: inline-block;
}
.social-icons li a {
width: 72px;
height: 72px;
display: block;
}
.social-icons li a.facebook {
background: url(../images/facebook_icon.png) no-repeat 0px 0px;
}
.social-icons li a.twitter {
background: url(../images/twitter_.png) no-repeat -56px 0px;
}
.social-icons li a.pinterest {
background: url(../images/pinterest.png) no-repeat -112px 0px;
}
.footer-grid p {
color: #A2A2A2;
font-size: 14px;
line-height: 1.5em;
padding: 0 0 0.4em 0;
}
.footer-grid input[type="text"] {
width: 84%;
margin: 0.4em 0 1em;
padding: 0.8em;
border: 1px solid #C3C3C3;
transition: border-color 0.5s all;
-webkit-transition: border-color 0.5s all;
-moz-transition: border-color 0.5s all;
-o-transition: border-color 0.5s all;
font-family: 'open_sanssemibold';
color: #3D3D3D;
outline: none;
border-radius: 0.5em;
-webkit-border-radius: 0.5em;
-moz-border-radius: 0.5em;
-o-border-radius: 0.5em;
}
.footer-grid input[type="text"]:hover {
border: 1px solid #999;
}
.footer-grid input[type="submit"] {
background: #F36EA7;
padding: 0.8em;
display: block;
width: 100%;
font-family: 'arial';
color: #FFF;
border: none;
font-size: 14px;
border-radius: 0.3em;
-webkit-border-radius: 0.3em;
-moz-border-radius: 0.3em;
-o-border-radius: 0.3em;
outline: none;
cursor: pointer;
transition: 0.5s all;
-webkit-transition: 0.5s all;
-moz-transition: 0.5s all;
-o-transition: 0.5s all;
}
.footer-grid input[type="submit"]:hover {
background: #EE639F;
}
.footer-grids {
padding: 3em 0 5em;
}
.copy-right {
margin-top: 1em;
}
.copy-right a {
color: #A2A2A2;
transition: 0.5s all;
-webkit-transition: 0.5s all;
-moz-transition: 0.5s all;
-o-transition: 0.5s all;
}
.copy-right a:hover {
color: #F36EA7;
}
you forgot to put display:inline-block in .footer-grid ul li
.footer-grid ul li{
display:inline-block;
}

Dropdown list In Navigation Bar

I want to make my "Poem From Me" and "Poem From Internet" drop down list going to under "Poems" section which is under About option. But now there is problem in there. This drop down list is behind "About" drop down list and i want to move it to the left next "Poems" option (I tried to use margin-left:250px) but it didn't work). I also want that whenever the person over his mouse on the "Poems" section the "Poem From Internet" and "Poem From Me" appears not the time that i hover over the "About" section! http://jsfiddle.net/2r1hbr3k/2/embedded/result/, http://jsfiddle.net/2r1hbr3k/2/
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<link rel="shortcut icon" href="Photo.ico">
<link href="StyleSheet.css" rel="stylesheet" />
<link href="animate.css" rel="stylesheet" />
<link href="animations.css" rel="stylesheet" />
<link href="hover.css" rel="stylesheet" />
<link href="gooeymenu.css" rel="stylesheet" />
<link href='http://fonts.googleapis.com/css?family=Oswald' rel='stylesheet' type='text/css'>
<script src="gooeymenu.js"></script>
<title>Social Activism</title>
</head>
<body>
<div style="background:#F5F5F0;">
<div>
<div style="float:left; margin-top:0; left:20px;"><img class="buzz" src="community-activism.png" width="80" height="80" /></div>
<h1 style="color:black; opacity:40;" class="shrink"><strong> Social Activism</strong></h1>
</div>
<br />
<div id="nav">
<div id="nav_wrapper" style="margin:0 auto; display:inline-block;">
</div>
<div>
<ul class="navigation">
<a class="main" href="#url" style="color:black;" id="blue">Home</a>
</ul>
<ul class="navigation">
<a class="main" href="#url" style="color:black;" id="blue">About ▼</a>
<li class="n1" id="selection">
Poems ►
<ul>
<li class="n6">
Poem From Internet
</li>
<li class="n7">
Poem By Me
</li>
</ul>
</li>
<li class="n2" id="selection">
Informational Media
</li>
<li class="n3" id="selection">
Visual/Video
</li>
<li class="n4" id="selection">
Photo Essay
</li>
<li class="n5" id="selection">
Me
</li>
</ul>
<ul class="navigation">
<a class="main" href="#url" style="color:black;" id="blue">From Internet ▼ </a>
<li class="n1" id="selection">
Poem
</li>
<li class="n2" id="selection">
Informational Media
</li>
<li class="n3" id="selection">
Visual/Video
</li>
<li class="n4" id="selection">
Photo Essay
</li>
</ul>
<ul class="navigation">
<a class="main" href="#url" style="color:black;" id="blue">By Me ▼</a>
<li class="n1" id="selection">
Poem
</li>
<li class="n2" id="selection">
Informational Media
</li>
<li class="n3" id="selection">
Visual/Video
</li>
<li class="n4" id="selection">
Photo Essay
</li>
</ul>
</div>
</div>
</div>
</body>
</html>
My CSS File:
body {
background: #DCDCD8;
}
h2 {
text-align: center;
color: #CCC;
}
a {
display: block;
text-decoration: none;
width: 100%;
height: 100%;
color: #999;
}
/* NAVIGATION */
.navigation {
list-style: none;
padding: 0;
width: 250px;
height: 40px;
margin: 0;
background: #F5F5F0;
position: relative;
z-index: 100;
display: inline-block;
vertical-align:top;
left:5px;
top:0px;
}
.navigation, .navigation a.main {
border-radius: 4px;
-webkit-border-radius: 4px;
-moz-border-radius: 4px;
}
.navigation:hover, .navigation:hover a.main {
border-radius: 4px 4px 0 0;
-webkit-border-radius: 4px 4px 0 0;
-moz-border-radius: 4px 4px 0 0;
}
.navigation a.main {
height: 40px;
font: bold 15px/40px arial, sans-serif;
text-align: center;
text-decoration: none;
color: #FFF;
-webkit-transition: 0.2s ease-in-out;
-o-transition: 0.2s ease-in-out;
transition: 0.2s ease-in-out;
position: relative;
z-index: 100;
display: inline-block;
}
.navigation li {
width: 250px;
height: 40px;
background: #F7F7F7;
font: normal 14px/40px arial, sans-serif !important;
color: #999;
text-align: center;
margin: 0;
-webkit-transform-origin: 50% 0%;
-o-transform-origin: 50% 0%;
transform-origin: 50% 0%;
-webkit-transform: perspective(350px) rotateX(-90deg);
-o-transform: perspective(350px) rotateX(-90deg);
transform: perspective(350px) rotateX(-90deg);
box-shadow: 0px 2px 10px rgba(0, 0, 0, 0.05);
-webkit-box-shadow: 0px 2px 10px rgba(0, 0, 0, 0.05);
-moz-box-shadow: 0px 2px 10px rgba(0, 0, 0, 0.05);
}
.navigation li:nth-child(even) {
background: #F5F5F5;
}
.navigation li:nth-child(odd) {
background: #EFEFEF;
}
.navigation li.n1 {
-webkit-transition: 0.2s linear 0.8s;
-o-transition: 0.2s linear 0.8s;
transition: 0.2s linear 0.8s;
}
.navigation li.n2 {
-webkit-transition: 0.2s linear 0.6s;
-o-transition: 0.2s linear 0.6s;
transition: 0.2s linear 0.6s;
}
.navigation li.n3 {
-webkit-transition: 0.2s linear 0.4s;
-o-transition: 0.2s linear 0.4s;
transition: 0.2s linear 0.4s;
}
.navigation li.n4 {
-webkit-transition: 0.2s linear 0.2s;
-o-transition: 0.2s linear 0.2s;
transition: 0.2s linear 0.2s;
}
.navigation li.n5 {
border-radius: 0px 0px 4px 4px;
-webkit-transition: 0.2s linear 0s;
-o-transition: 0.2s linear 0s;
transition: 0.2s linear 0s;
}
.navigation:hover li {
-webkit-transform: perspective(350px) rotateX(0deg);
-o-transform: perspective(350px) rotateX(0deg);
transform: perspective(350px) rotateX(0deg);
-webkit-transition: 0.2s linear 0s;
-o-transition: 0.2s linear 0s;
transition: 0.2s linear 0s;
}
.navigation:hover .n2 {
-webkit-transition-delay: 0.2s;
-o-transition-delay: 0.2s;
transition-delay: 0.2s;
}
.navigation:hover .n3 {
-webkit-transition-delay: 0.4s;
-o-transition-delay: 0.4s;
transition-delay: 0.4s;
}
.navigation:hover .n4 {
transition-delay: 0.6s;
-o-transition-delay: 0.6s;
transition-delay: 0.6s;
}
.navigation:hover .n5 {
transition-delay: 0.8s;
-o-transition-delay: 0.8s;
transition-delay: 0.8s;
}
#option:hover ,#blue:hover {
color: white;
background-color:#19A3FF;
}
#option:active {
color: white;
background-color:#1c5f8d;
}
#blue:active {
color: white;
background-color: #1c5f8d;
}
#option {
color: black;
}
#blue {
color: black;
}
Is this what you meant?
.navigation ul {
display: none;
position: relative;
top: -40px;
left: 250px;
list-style-type: none;
margin: 0;
padding: 0;
}
.navigation li:hover ul {
display: block;
}
Here's a fiddle: http://jsfiddle.net/Niffler/bxuv14Ld/

bootstrap 3 mobile collapse fade in and out on toggle

0Is there anyway of replacing the slide down animation on the mobile navbar-collapse to fade in/out when called upon? I've tried using CSS keyframes and have managed to get the animation working but in reverse - instead of the the menu fading in and out when called upon, the menu is open when the page loads and fades out when the toggle button is pressed.
This is the nav html:
<nav class="navbar navbar-inverse navbar-fixed-top">
<div class="center">
<div class="navbar-header">
<button type="button" class="navbar-toggle" data-toggle="collapse" data-target=".navbar- collapse">
<i class="fa fa-bars fa-2x"></i>
</button>
</div>
</div>
<div class="navbar-collapse collapse">
<ul class="nav navbar-nav">
<li class="active">Home</li>
<li>Dierentuin</li>
<li>B-Roll</li>
<li>Carousel</li>
<li>Structural Curtains</li>
<li>Proxy</li>
<li>Art in the Underbelly</li>
<li>Suburbanism</li>
<li>Novelty</li>
<li>Album Covers</li>
<li>Fortyounce London</li>
<li>Covmns Clothing</li>
<li>Siobahn Palmer</li>
<li>Django Django</li>
<li>I like Trains</li>
<li>Glass Animals</li>
<li>Spring Offensive</li>
<li>Black Bird</li>
<li>Olympians</li>
<li>The Soft</li>
<li>Wordplay Issue #10</li>
</ul>
</div>
</nav>
The CSS is as follows:
.navbar-nav {
margin: 0;
min-height: auto;
}
.navbar-nav {
float: none!important;
}
.navbar-nav>li {
float: none;
}
.navbar-inverse {
background-color: transparent;
border-color: transparent;
}
.navbar-inverse .navbar-toggle:hover, .navbar-inverse .navbar-toggle:focus {
background-color: transparent;
}
.navbar-inverse .navbar-toggle {
border-color: transparent;
}
.nav>li{
display:inline-block;
}
.collapsing {
opacity: 0;
transition:opacity 0.3s linear;
-webkit-transition:opacity 0.3s linear;
-moz-transition:opacity 0.3s linear;
-o-transition:opacity 0.3s linear;
}
.navbar-collapse.collapse.in{
opacity:0;
transition:opacity 0.3s linear;
-webkit-transition:opacity 0.3s linear;
-moz-transition:opacity 0.3s linear;
-o-transition:opacity 0.3s linear;
}
.navbar-collapse.collapse{
opacity: 1;
transition:opacity 0.3s linear;
-webkit-transition:opacity 0.3s linear;
-moz-transition:opacity 0.3s linear;
-o-transition:opacity 0.3s linear;
}
.navbar-collapse {
width: auto;
border-top: 0;
-webkit-box-shadow: none;
box-shadow: none;
margin-top: 194px;
max-height: none;
font-family:"aktiv-grotesk-std";
font-weight: 400;
line-height: 54px;
font-size: 60px;
display:block !important;
}
I'm still learning how to get to grips with Bootstrap 3, so any help would be gratefully received.
Since the collapse plugin modifies the height of the collapsable container you could override the height property using !important:
.navbar-collapse {
opacity: 0;
width: auto;
height: auto !important;
border-top: 0;
-webkit-box-shadow: none;
box-shadow: none;
margin-top: 194px;
max-height: none;
font-family:"aktiv-grotesk-std";
font-weight: 400;
line-height: 54px;
font-size: 60px;
display:block !important;
}
I also included an example on jsfiddle: http://jsfiddle.net/VVrPd/
You should also be careful when using !important, it's not a good practice: What are the implications of using "!important" in CSS?
This solution works better for me, and gets rid of setting the height auto and the !important rules:
.navbar-collapse {
transition: height 3s , opacity 0.3s ;
opacity: 0;
}
There is still a 'slide' transition, but the workaround is setting enough delay (in this case 3s) so will be invisible to the user

Bootstrap - My mobile toggle button appears in all viewports?

I have been watching tutorials on creating a responsive navbar and one thing I am trying to create is a responsive menu button. I have created the button as you can see here:
http://jsfiddle.net/nickmadd/LvhCh/4/
The HTML
<nav class="navbar navbar-default affix-top nav-links" data-spy="affix" data-offset-top="100" role="navigation">
<div class="container">
<button class="navbar-toggle" data-target=".navbar-responsive-collapse" data-toggle="collapse" type="button"> <span class="icon-bar"></span> <span class="icon-bar"></span> <span class="icon-bar"></span>
</button>
<div class="navbar-header"> <a class="navbar-brand" href="/"><img src="media/img/nav-logo.png" alt="Driven Car Sales Logo" class="img-rounded logo-nav navbar-brand" /></a>
</div>
<div class="nav-collapse navbar-responsive-collapse" data-toggle="collapse" data-target=".navbar-nav">
<ul class="nav navbar-nav">
<li>Used Cars
</li>
<li>Get Finance
</li>
<li class="dropdown">About Driven<strong class="caret"></strong>
<ul class="dropdown-menu">
<li> <a href "#">The Team</a>
</li>
<li> <a href "#">Our Partners</a>
</li>
</ul>
<!--Drop Down End-->
</li>
<li>How To Find Us
</li>
<li>Contact Us
</li>
</ul>
</div>
</div>
</nav>
The CSS
.navbar-toggle {
display: block;
}
.logo-nav {
height: 2.3em;
width: auto;
}
.brand {
font-size: 2em;
margin: 20px 0 25px;
}
.navbar-brand {
opacity: 0;
color: #ff0066;
-webkit-transition:opacity 0.3s ease-in;
-moz-transition:opacity 0.3s ease-in;
-o-transition:opacity 0.3s ease-in;
transition: opacity 0.3s ease-in;
margin-left: 0px;
}
.navbar {
border-radius: 0px;
border-left: none;
border-right: none;
}
.navbar-default .navbar-nav>.open>a, .navbar-default .navbar-nav>.open>a:hover, .navbar- default .navbar-nav>.open>a:focus {
color: #fff;
background-color: #DD3B4D;
}
.navbar-default .navbar-nav>li>a:hover, .navbar-default .navbar-nav>li>a:focus {
color: #fff;
}
.dropdown-menu {
color: #fff;
background-color: #DD3B4D;
}
.dropdown-menu>li>a {
color: #fff;
}
nav.affix {
top: 0;
width: 100%;
z-index: 1000;
}
nav.affix .navbar-brand {
opacity: 1;
height: 2.3em;
width: auto;
}
.navbar-header {
width: 0px;
-webkit-transition:width .4s ease-in-out;
-moz-transition:width .4s ease-in-out;
-o-transition:width .4s ease-in-out;
transition:width .4s ease-in-out;
margin: 0 1em 0 1em
}
nav.affix .navbar-header {
width: 8em;
-webkit-transition: width .4s ease-in-out;
-moz-transition: width .4s ease-in-out;
-o-transition: width .4s ease-in-out;
transition: width .4s ease-in-out;
margin: 0 1em 0 0;
}
.nav-links {
font: 600 15px/1.5'Arimo';
}
.navbar-nav > li:last-child {
border-right: 1px solid #475d88;
}
ul.nav a:hover {
color: #fff !important;
background-color: #DD3B4D !important;
-webkit-transition: background-color 0.6s ease;
-moz-transition: background-color 0.6s ease;
-o-transition: background-color 0.6s ease;
transition: background-color 0.6s ease;
}
nav.affix .navbar-brand {
display: inline-block;
}
The issue is that when it opens in the browser it is still there even in a large viewpoint. I need it to appear when it get's towards mobile size. I could go and do this with media queries but I'm sure that bootstrap is meant to do this for you?
Am I missing something?
It's because you are overriding the Bootstrap css with your own css, at the very top of your css you have:
.navbar-toggle {
display: block;
}
which tells ".navbar-toggle" to always show. Remove this and it will show/hide correctly. Also these docs might be useful if you have any more trouble.
Update
Updated fiddle with correct syntax. The main issue was that you had .nav-collapse instead of .navbar-collapse.
You are missing the hidden class which is a large part of bootstrap's responsiveness on different viewport sizes. Check out this bootply
Your button works fine when you make it hidden on large and medium viewports:
<button class="navbar-toggle hidden-md hidden-lg" data-target=".navbar-responsive-collapse" data-toggle="collapse" type="button"> <span class="icon-bar"></span> <span class="icon-bar"></span> <span class="icon-bar"></span>
</button>
Read about the sizes and hiding here. You can add that class to everything in bootstrap, so move it around if you want to hide more or less.