links jump out of navigation when resized (responsive) - html

I have two problems with my navigation in twitter bootstrap.
the links jump out of the navigation when I re-size the browser window
and 2. the collapsed navigation is hidden behind the carousel.
I want all my links in the navigation to have the same width, because they get a border in mouse-over but because of that they jump out of the navigation and are hidden behind the carousel/slider when re-sized.
They collapse just fine when re-sized to 768px but everything above that jumps out of navigation. And the other thing is that when the navigation is collapsed it is half hidden behind the carousel/slider when opened.
<nav class="navbar navbar-inverse" role="navigation">
<button type="button" class="navbar-toggle" data-toggle="collapse" data-target=".navbar-collapse">
<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="index.html">Test</a>
</div>
<div class="nav-collapse collapse navbar-collapse">
<ul class="nav navbar-nav navbar-right">
<li class="span4">Home</li>
<li class="span4">Forschung</li>
<li class="span4">Fahrzeug</li>
<li class="span4">Team</li>
<li class="span4">Presse</li>
<li class="span4">Ziele</li>
<li class="span4">Karte</li>
<li class="span4">Jobs</li>
</ul>
</div>
</nav>
<div class="container">
<div id="this-carousel-id" class="carousel slide">
<ol class="carousel-indicators">
<li data-target="#this-carousel-id" data-slide-to="0" class="active"></li>
</ol>
<div class="carousel-inner">
<div class="item active">
<img src="http://placehold.it/1200x480" alt="" />
<div class="carousel-caption"><h1>Mercedes Benz</h1></div>
</div>
</div>
<a class="carousel-control left" href="#this-carousel-id" data-slide="prev"><span class="glyphicon glyphicon-chevron-left"></span></a>
<a class="carousel-control right" href="#this-carousel-id" data-slide="next"><span class="glyphicon glyphicon-chevron-right"></span></a>
</div>
</div>
and this is the css
.navbar {
height: 100px;
font-family: 'Oswald', sans-serif;
text-transform: uppercase;
-webkit-border-radius: 0;
-moz-border-radius: 0;
border-radius: 0;
padding-right: 5%;
background-color: #000000 !important;
box-sizing: border-box;
}
.navbar-inverse .navbar-nav > li > a { color: #a2a2a2 !important }
.nav a:link,
a:visited {
line-height: 4em;
display: block;
height: 100px;
width: 120px;
text-align: center;
text-decoration: none;
}
.nav a:after {
position: absolute;
top: 100%;
left: 0;
width: 100%;
height: 1px;
background: #062d67;
content: '';
opacity: 0;
-webkit-transition: height 0.3s, opacity 0.3s, -webkit-transform 0.3s;
-moz-transition: height 0.3s, opacity 0.3s, -moz-transform 0.3s;
transition: height 0.3s, opacity 0.3s, transform 0.3s;
-webkit-transform: translateY(-10px);
-moz-transform: translateY(-10px);
transform: translateY(-10px);
}
.nav a:hover,
a:focus,
a:active {
height: 81px;
color: #ffffff !important;
background-color: #0d0d0d !important;
}
.nav a:hover:after,
.nav a:focus:after,
.nav a:active:after {
height: 18px;
opacity: 1;
-webkit-transform: translateY(0px);
-moz-transform: translateY(0px);
transform: translateY(0px);
}
Can anyone please point out what I did wrong?

You can't have 8 span4 elements in one row. the total sum of N in spanN must be 12 or below.
you can use span1in your case or no class on for <li> (list item) elements at all.

Related

How to tilt hover in CSS

I try to stylize hover for the header.
It shows like this.
And I want to make it look like this:
Even when I tried skew, the text was also tilting with it.
Help will be appreciated.
Here is my code:
.hvr-link {
display: inline-block;
vertical-align: middle;
-webkit-transform: perspective(1px) translateZ(0);
transform: perspective(1px) translateZ(0);
box-shadow: 0 0 1px rgba(0, 0, 0, 0);
position: relative;
-webkit-transition-property: color;
transition-property: color;
-webkit-transition-duration: 0.3s;
transition-duration: 0.3s;
}
.hvr-link:before {
content: "";
position: absolute;
z-index: -1;
top: 0;
bottom: 0;
left: 0;
right: 0;
background: #424141;
-webkit-transform: scaleY(0);
transform: scaleY(0);
-webkit-transform-origin: 50%;
transform-origin: 50%;
-webkit-transition-property: transform;
transition-property: transform;
-webkit-transition-duration: 0.3s;
transition-duration: 0.3s;
-webkit-transition-timing-function: ease-out;
transition-timing-function: ease-out;
}
.hvr-link:hover,
.hvr-link:focus,
.hvr-link:active {
color: white;
}
.hvr-link:hover:before,
.hvr-link:focus:before,
.hvr-link:active:before {
-webkit-transform: scaleY(1);
transform: scaleY(1);
}
<div class="col-md-7 col-sm-12">
<div class="nav-outer clearfix menu-bg">
<!--main-menu start-->
<nav class="main-menu">
<div class="navbar-header">
<button type="button" class="navbar-toggle" data-toggle="collapse" data-target=".navbar-collapse"> <span class="icon-bar"></span> <span class="icon-bar"></span> <span class="icon-bar"></span> </button>
</div>
<div class="navbar-collapse collapse clearfix">
<ul class="navigation clearfix">
<li class="hvr_link"><a class="hvr-link" href="#top">Home</a>
</li>
<li><a class="hvr-link" href="#service">Services</a>
</li>
<li class="dropdown"><a class="hvr-link" href="#">About</a>
<ul>
<li><a class="hvr-link" href="#aboutmy">About</a></li>
<li><a class="hvr-link" href="#teammy">Team</a></li>
</ul>
</li>
<li><a class="hvr-link" href="#portfoliomy">Portfolio</a>
</li>
<li><a class="hvr-link2" href="#propertymy">Properties</a>
</li>
<li><a class="hvr-link2" href="#contactmy">Contact</a></li>
</ul>
</div>
<div class="clearfix"></div>
</nav>
<!--main-menu end-->
</div>
</div>
In this context, it can be a little bit tricky because you have to put the link text in a span element in order to be able to achieve this.
Check the snippet below, a quick explanation:
What transform: skewX(20deg); does to .menu li a is basically tilt the link as you require. The problem there is that that tilts the entire element, text included. That's why you use a span inside your link and apply a counter tilt to that span using transform: skewX(-20deg);. It's basically resulting in a final 0 degree tilt. The rest of the styles I added just to simulate your requirements.
Also, it's important that the a elements use inline-block if you're not using float or block if you're using float, otherwise they are not affected by the tilt. Same applies to the inner span element.
It would look something like this:
.menu {
display: flex;
flex-direction: row;
flex-wrap: wrap;
list-style: none;
background: #3d424a;
}
.menu li a {
color: #c3c5c7;
text-decoration: none;
display: inline-block;
transform: skewX(20deg);
font-family: Arial;
font-weight: bold;
text-transform: uppercase;
padding: 2rem;
transition: background 0.15s ease-in-out, color 0.15s ease-in-out;
}
.menu li a span {
transform: skewX(-20deg);
display: block;
}
.menu li a:hover {
background: #fda539;
color: #3d424a;
}
<ul class="menu">
<li>
<span>Home</span>
</li>
<li>
<span>About</span>
</li>
<li>
<span>Contact</span>
</li>
</ul>
you can hover and create images. I added in the text to show you how to unskew the text as well so it doesn't get messed up on hovering.
.navigation {
transform: skew(20deg);
width: 100px;
height: 20px;
}
ul {
list-style-type: none;
}
ul li a {
display: block;
transform: skew(-20deg);
text-align: center;
}
li:hover {
background: orange;
}
<div class="col-md-7 col-sm-12">
<div class="nav-outer clearfix menu-bg">
<!--main-menu start-->
<nav class="main-menu">
<div class="navbar-header">
<button type="button" class="navbar-toggle" data-toggle="collapse" data-target=".navbar-collapse"> <span class="icon-bar"></span> <span class="icon-bar"></span> <span class="icon-bar"></span> </button>
</div>
<div class="navbar-collapse collapse clearfix">
<ul class="navigation clearfix">
<li class="hvr_link"><a class="hvr-link" href="#top">Home</a>
</li>
<li><a class="hvr-link" href="#service">Services</a>
</li>
<li class="dropdown"><a class="hvr-link" href="#">About</a>
<ul>
<li><a class="hvr-link" href="#aboutmy">About</a></li>
<li><a class="hvr-link" href="#teammy">Team</a></li>
</ul>
</li>
<li><a class="hvr-link" href="#portfoliomy">Portfolio</a>
</li>
<li><a class="hvr-link2" href="#propertymy">Properties</a>
</li>
<li><a class="hvr-link2" href="#contactmy">Contact</a></li>
</ul>
</div>
<div class="clearfix"></div>
</nav>
<!--main-menu end-->
</div>
</div>
#parallelogram {
width: 150px;
height: 100px;
transform: skew(20deg);
background: red;
}
https://css-tricks.com/the-shapes-of-css/#parallelogram-shape

Navbar height ignored by Chrome and Safari

I found an unpleasant surprise in a local project that I'm developing, two weeks ago I visualized everything correctly but now on Chrome and Safari the height of the navbar is ignored, on Firefox instead it works all regularly as well as on Codepen. The website is based on Wordpress + Bootstrap 4
firefox vs chrome
The HTML:
<nav id="top-navbar" class="navbar sticky-top navbar-expand-lg navbar-dark animate">
<div class="container">
<button class="navbar-toggler navbar-toggler-right" type="button" data-toggle="collapse" data-target="#bs4navbar" aria-controls="bs4navbar" aria-expanded="false" aria-label="Toggle navigation">
<span class="navbar-toggler-icon"></span>
</button>
<div id="bs4navbar" class="collapse navbar-collapse mx-auto">
<ul id="menu-left" class="navbar-nav ml-auto"><li id="menu-item-27" class="menu-item menu-item-type-custom menu-item-object-custom menu-item-27 nav-item">Home</li>
<li id="menu-item-28" class="menu-item menu-item-type-post_type menu-item-object-page current-menu-item page_item page-item-23 current_page_item menu-item-28 nav-item active">About</li>
<li id="menu-item-29" class="menu-item menu-item-type-post_type menu-item-object-page menu-item-has-children menu-item-29 nav-item dropdown">Gallery
<div class="dropdown-menu">
BespokeCollections</div>
</li>
</ul>
<a class="navbar-brand logo animate d-none d-sm-block" href="http://hebi.local">
<img class="animate" src="https://www.hsdtaxlaw.com/wp-content/uploads/2016/05/logo_placeholder.png" alt="Logo">
</a>
<ul id="menu-right" class="navbar-nav mr-0"><li id="menu-item-35" class="menu-item menu-item-type-post_type menu-item-object-page menu-item-35 nav-item">Contact</li>
</ul>
<div class="external mr-auto">
Shop
<i class="fab fa-facebook-f"></i>
<i class="fab fa-instagram"></i>
</div>
</div>
</div>
</nav>
And the custom CSS:
.navbar {
margin:0;
border:none;
border-radius:0;
background-image: none;
text-transform: uppercase;
background: #000;
font-family: 'Cinzel', serif;
}
.logo a {
display: block;
position: relative;
max-height: 100px;
}
.logo img{
max-width: 200px;
max-height: 100px;
padding: .5rem;
-webkit-transition: all ease .2s;
transition: all ease .2s;
}
.navbar a {
color: #cc0000;
}
.navbar .btn-primary {
background: #CC0000;
border: solid #CC0000;
color: #FFF;
}
.navbar .btn-primary:hover {
background: #F81717;
border: solid #F81717;
color: #FFF;
-webkit-transition: background-color .3s ease;
transition: background-color .3s ease;
}
.navbar-nav ul{list-style-type: none}
.navbar-nav li .dropdown-menu li a{line-height: 50px; height: 50px;}
.spacer{height: 50px;}
.no-margin{margin:0; padding:0;}
.navbar li a {
-webkit-transition: color ease .2s;
transition: color ease .2s;
display: inline-block;
padding: 0 15px;
font-weight: 400;
letter-spacing: 2px;
font-style: normal;
text-transform: uppercase;
}
Well after taking a look at your code, I see you have nowhere specified any height at all. The only height specification is on the logo img element and only the max-height is defined. That could be the cause for your issue, since the height of your navbar depends on that element. Setting a fixed height or min-height to your img will solve your issue.
.logo img{
max-width: 200px;
min-height: 100px;
max-height: 100px;
padding: .5rem;
-webkit-transition: all ease .2s;
-moz-transition: all ease .2s;
-ms-transition: all ease .2s;
-o-transition: all ease .2s;
transition: all ease .2s;
}
Is there a specific reason why the navbar element does not have a height set. Setting the height will indeed help you and it will make the result look more consistent across browsers.

Logo image to overflow menu bar

I am having difficulty getting the logo image (red) to overflow the menu bar, currently the menu bar is extended once the logo is added (see the image).
The HTML Code:
<div id="page" class="page">
<div class="pixfort_normal_1" id="section_header_2_dark">
<div class="header_nav_1 dark pix_builder_bg" style="background-image: none; background-color: rgb(13, 52, 64); padding-top: 0px; padding-bottom: 0px; box-shadow: none; border-color: rgb(255, 255, 255); background-size: auto; background-attachment: scroll; background-repeat: repeat;">
<div class="container">
<div class="sixteen columns firas2">
<nav role="navigation" class="navbar navbar-white navbar-embossed navbar-lg pix_nav_1">
<div class="containerss">
<div class="navbar-header">
<button data-target="#navbar-collapse-02" data-toggle="collapse" class="navbar-toggle pix_text" type="button">
<span class="sr-only ">Toggle navigation</span>
</button>
<img src="images/LOGO1.png" class="pix_nav_logo">
</div>
<div id="navbar-collapse-02" class="collapse navbar-collapse">
<ul class="nav navbar-nav navbar-right">
<li class="active propClone">Home</li>
<li class="propClone">About</li>
<li class="propClone">Workshops and Training</li>
<li class="propClone">Contact</li>
</ul>
</div><!-- /.navbar-collapse -->
</div><!-- /.container -->
</nav>
</div>
</div><!-- container -->
</div>
</div>
The CSS Code:
.pix_nav_1 ul li a {
color: rgba(0, 0, 0, 0.5);
-webkit-transition: all 0.2s linear;
-moz-transition: all 0.2s linear;
-ms-transition: all 0.2s linear;
-o-transition: all 0.2s linear;
};
.pix_nav_1 ul li a:hover {
//color: rgba(0,0,0,0.85);
opacity: 0.6;
}
.header_nav_1 {
padding: 0px !important;
box-shadow: none;
}
.pix_nav_logo {
background: url(../images/t_logo.png) no-repeat;
padding-top: 0px;
overflow: visible;
}
.navbar-center {margin-left: auto;margin-right: auto;float: none;position:
relative;text-align: center; }
.navbar-center li { text-align: center;float: none;display: inline-block;}
Could someone please assist me to how I can get the logo to overflow the menu. Thanks in advance!
Try this
.pix_nav_logo {
position: absolute;
}
You can adjust the logo by playing with different values for css property left and right for .pix_nav_logo.
position: absolute : The element is positioned relative to its first positioned (not static) ancestor element.
.pix_nav_logo {
background: url(../images/t_logo.png) no-repeat;
padding-top: 0px;
overflow: visible;
width: 100px; // This for your logo size
position: absolute; // This is absolute position of logo
}
.pix_nav_1 ul li a {
color: rgba(0, 0, 0, 0.5);
-webkit-transition: all 0.2s linear;
-moz-transition: all 0.2s linear;
-ms-transition: all 0.2s linear;
-o-transition: all 0.2s linear;
}
;
.pix_nav_1 ul li a:hover {
//color: rgba(0,0,0,0.85);
opacity: 0.6;
}
.header_nav_1 {
padding: 0px !important;
box-shadow: none;
}
.pix_nav_logo {
background: url(../images/t_logo.png) no-repeat;
padding-top: 0px;
overflow: visible;
width: 100px;
position: absolute;
}
.navbar-center {
margin-left: auto;
margin-right: auto;
float: none;
position: relative;
text-align: center;
}
.navbar-center li {
text-align: center;
float: none;
display: inline-block;
}
<link href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css" rel="stylesheet"/>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/js/bootstrap.min.js"></script>
<div id="page" class="page">
<div class="pixfort_normal_1" id="section_header_2_dark">
<div class="header_nav_1 dark pix_builder_bg" style="background-image: none; background-color: rgb(13, 52, 64); padding-top: 0px; padding-bottom: 0px; box-shadow: none; border-color: rgb(255, 255, 255); background-size: auto; background-attachment: scroll; background-repeat: repeat;">
<div class="container">
<div class="sixteen columns firas2">
<nav role="navigation" class="navbar navbar-white navbar-embossed navbar-lg pix_nav_1">
<div class="containerss">
<div class="navbar-header">
<button data-target="#navbar-collapse-02" data-toggle="collapse" class="navbar-toggle pix_text" type="button">
<span class="sr-only ">Toggle navigation</span>
</button>
<img src="http://www.hjmt.com/blog/wp-content/uploads/2012/08/Logo_TV_2015.png" class="pix_nav_logo">
</div>
<div id="navbar-collapse-02" class="collapse navbar-collapse">
<ul class="nav navbar-nav navbar-right">
<li class="active propClone">Home</li>
<li class="propClone">About</li>
<li class="propClone">Workshops and Training</li>
<li class="propClone">Contact</li>
</ul>
</div>
<!-- /.navbar-collapse -->
</div>
<!-- /.container -->
</nav>
</div>
</div>
<!-- container -->
</div>
</div>

How to keep the small sidebar style when screen size change ?

I want to create a small side navbar for a mobile first web map.
I found a snippet of code that do what I want but when the page reduce to a specific width the navbar stick to the top then I lose the effect I want to create with the small sliding icons. I try to change the min-width in the media query it did change. Please do propose a Jquery approach, I like this simple html and css method.
This is the link for the Bootsnipp, I am working on : http://bootsnipp.com/user/snippets/pjyo4
<div class="container-fluid">
<div class="navbar-header">
<button type="button" class="navbar-toggle" data-toggle="collapse" data-target="#bs-sidebar-navbar-collapse-1">
<span class="sr-only">Toggle navigation</span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
</button>
</div>
<div class="collapse navbar-collapse" id="bs-sidebar-navbar-collapse-1">
<ul class="nav navbar-nav">
<li class="active">
Acceuil<span style="font-size:16px;" class="pull-right hidden-xs showopacity glyphicon glyphicon-home"></span>
</li>
<li class="dropdown">
<a href="#" class="dropdown-toggle" data-toggle="dropdown">Utilisateur<span class="caret"></span>
<span style="font-size:16px;" class="pull-right hidden-xs showopacity glyphicon glyphicon-user"></span>
</a>
<ul class="dropdown-menu forAnimate" role="menu">
<li>Créer</li>
<li>Modifier</li>
<li>Reporter</li>
<li class="divider"></li>
<li>Lien séparé</li>
<li class="divider"></li>
<li>Information</li>
</ul>
</li>
<li >
Référence<span style="font-size:16px;" class="pull-right hidden-xs showopacity glyphicon glyphicon-th-list"></span>
</li>
<li >
Tags<span style="font-size:16px;" class="pull-right hidden-xs showopacity glyphicon glyphicon-tags"></span>
</li>
</ul>
</div>
and this is my CSS3 :
body,html{
height: 100%;
}
nav.sidebar, .main{
-webkit-transition: margin 200ms ease-out;
-moz-transition: margin 200ms ease-out;
-o-transition: margin 200ms ease-out;
transition: margin 200ms ease-out;
}
.main{
padding: 10px 10px 0 10px;
}
#media (min-width: 765px) {
.main{
position: absolute;
width: calc(100% - 40px);
margin-left: 40px;
float: right;
}
nav.sidebar:hover + .main{
margin-left: 200px;
}
nav.sidebar.navbar.sidebar>.container .navbar-brand, .navbar>.container-fluid .navbar-brand {
margin-left: 0px;
}
nav.sidebar .navbar-brand, nav.sidebar .navbar-header{
text-align: center;
width: 100%;
margin-left: 0px;
}
nav.sidebar a{
padding-right: 13px;
}
nav.sidebar .navbar-nav > li:first-child{
border-top: 1px #e5e5e5 solid;
}
nav.sidebar .navbar-nav > li{
border-bottom: 1px #e5e5e5 solid;
}
nav.sidebar .navbar-nav .open .dropdown-menu {
position: static;
float: none;
width: auto;
margin-top: 0;
background-color: transparent;
border: 0;
-webkit-box-shadow: none;
box-shadow: none;
}
nav.sidebar .navbar-collapse, nav.sidebar .container-fluid{
padding: 0 0px 0 0px;
}
.navbar-inverse .navbar-nav .open .dropdown-menu>li>a {
color: #777;
}
nav.sidebar{
width: 200px;
height: 200px;
margin-left: -160px;
float: left;
margin-bottom: 0px;
}
nav.sidebar li {
width: 100%;
}
nav.sidebar:hover{
margin-left: 0px;
}
.forAnimate{
opacity: 0;
}
}
#media (min-width: 1330px) {
.main{
width: calc(100% - 200px);
margin-left: 200px;
}
nav.sidebar{
margin-left: 0px;
float: left;
}
nav.sidebar .forAnimate{
opacity: 1;
}
}
nav.sidebar .navbar-nav .open .dropdown-menu>li>a:hover, nav.sidebar
.navbar-nav .open .dropdown-menu>li>a:focus {
color: #CCC;
background-color: transparent;
}
nav:hover .forAnimate{
opacity: 1;
}
section{
padding-left: 15px;
}
My goal is to keep the sidebar style with the small icons that show when mouse over the side bar.
If I understood you right, you want that the menu stays at the left side all the time and doesn't switch to the mobile dropdown at the top.
If you delete the part which displays the dropdown:
<div class="container-fluid">
<div class="navbar-header">
<button type="button" class="navbar-toggle" data-toggle="collapse" data-target="#bs-sidebar-navbar-collapse-1">
<span class="sr-only">Toggle navigation</span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
</button>
</div>
</div>
and additionally to that the media query in the css:
#media (min-width: 765px) {
which limits the CSS at a screen width bigger than 765px.
Now you have your menu all the time at the left side.
The only problem is that the glyphicons and letters are hidden, and I don't know why.
Sadly I am not so familiar with bootstrap .. but I hope I could help you a little bit.

additional space between sidebar and top bar

My code is a bit messy as i am learning bootstrap.
How do i go about resolving the empty space between the top and side bar
<!DOCTYPE html>
<html lang="en">
<style type="text/css">
.navbar-brand>img {
max-height: 100%;
height: 100%;
width: auto;
margin: 0 auto;
/* probably not needed anymore, but doesn't hurt */
-o-object-fit: contain;
object-fit: contain;
}
</style>
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1">
<meta name="description" content="">
<meta name="author" content="">
<title>Simple Sidebar - Start Bootstrap Template</title>
<!-- Bootstrap Core CSS -->
<link href="css/bootstrap.min.css" rel="stylesheet">
<!-- Custom CSS -->
<link href="css/simple-sidebar.css" rel="stylesheet">
<!-- HTML5 Shim and Respond.js IE8 support of HTML5 elements and media queries -->
<!-- WARNING: Respond.js doesn't work if you view the page via file:// -->
<!--[if lt IE 9]>
<script src="https://oss.maxcdn.com/libs/html5shiv/3.7.0/html5shiv.js"></script>
<script src="https://oss.maxcdn.com/libs/respond.js/1.4.2/respond.min.js"></script>
<![endif]-->
</head>
<body>
<nav class="navbar navbar-default">
<div class="container">
<div class="navbar-header">
<button type="button" class="navbar-toggle collapsed" data-toggle="collapse" data-target="#navbar" aria-expanded="false" aria-controls="navbar">
<!-- <span class="sr-only">Toggle navigation</span> -->
<span class="icon-bar"></span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
</button>
<a class="navbar-brand" href="http://disputebills.com"><img src="http://disputebills.com/site/uploads/2015/10/dispute.png" alt="Dispute Bills"></a>
</div>
<div id="navbar" class="collapse navbar-collapse">
<ul class="nav navbar-nav">
<li class="active">Home</li>
<li>About</li>
<li>Contact</li>
</ul>
</div>
</div>
</nav>
</div>
<div id="wrapper">
<!-- Sidebar -->
<div id="sidebar-wrapper">
<ul class="sidebar-nav">
<li class="sidebar-brand">
<a href="#">
TER
</a>
</li>
<li>
</li>
<li>
</li>
<li>
</li>
<li>
</li>
<li>
</li>
<li>
</li>
<li>
</li>
</ul>
</div>
<!-- /#sidebar-wrapper -->
<!-- Page Content -->
<div id="page-content-wrapper">
<div class="container-fluid">
<div class = "row">
<div class = "panel panel-default">
<div class = "panel-header">
<h1> TER</H1>
</div>
</div>
</div>
<div class="row">
<div class="col-lg-3 col-md-3">
<div class = "panel panel-default">
<div class = "panel-body">
<img src="images.jpg" class="img-circle " alt="Cinque Terre" width="200" height="200">
</div>
Toggle Menu
</div>
</div>
<div class="col-lg-6 col-md-6">
</div>
<div class="col-lg-3 col-md-3">
<h1>TER</h1>
<div class = "panel panel-default">
</div>
</div>
</div>
</div>
</div>
<div id ="charts-wrapper">
<div class = "container-fluid">
<div class = "row">
<div col = "col-lg-3">
haha
</div>
</div>
</div>
</div>
<!-- /#page-content-wrapper -->
<!-- /#wrapper -->
<!-- jQuery -->
<script src="js/jquery.js"></script>
<!-- Bootstrap Core JavaScript -->
<script src="js/bootstrap.min.js"></script>
<!-- Menu Toggle Script -->
<script>
$("#menu-toggle").click(function(e) {
e.preventDefault();
$("#wrapper").toggleClass("toggled");
});
</script>
</body>
Attached is a snippet of the page.
I would like the side and top bar to be joined together as bar of the template frame of my webpage.
/*!
* Start Bootstrap - Simple Sidebar HTML Template (http://startbootstrap.com)
* Code licensed under the Apache License v2.0.
* For details, see http://www.apache.org/licenses/LICENSE-2.0.
*/
/* Toggle Styles */
#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: 250px;
}
#sidebar-wrapper {
z-index: 1000;
position: fixed;
left: 250px;
width: 0px;
height: 100%;
margin-left: -250px;
overflow-y: auto;
background: #000;
-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 #sidebar-wrapper {
width: 250px;
}
#page-content-wrapper {
width: 100%;
position: absolute;
padding: 15px;
}
#wrapper.toggled #page-content-wrapper {
position: absolute;
margin-right: -250px;
}
/* Sidebar Styles */
.sidebar-nav {
position: absolute;
top: 0;
width: 250px;
margin: 0;
padding: 0;
left: 0;
list-style: none;
}
.sidebar-nav li {
text-indent: 20px;
line-height: 40px;
}
.sidebar-nav li a {
display: block;
text-decoration: none;
color: #999999;
}
.sidebar-nav li a:hover {
text-decoration: none;
color: #fff;
background: rgba(255,255,255,0.2);
}
.sidebar-nav li a:active,
.sidebar-nav li a:focus {
text-decoration: none;
}
.sidebar-nav > .sidebar-brand {
height: 65px;
font-size: 18px;
line-height: 60px;
}
.sidebar-nav > .sidebar-brand a {
color: #999999;
}
.sidebar-nav > .sidebar-brand a:hover {
color: #fff;
background: none;
}
#media(min-width:768px) {
#wrapper {
padding-left: 250px;
}
#wrapper.toggled {
padding-left: 0;
}
#sidebar-wrapper {
width: 250px;
}
#wrapper.toggled #sidebar-wrapper {
width: 0;
}
#page-content-wrapper {
padding: 20px;
position: relative;
}
#wrapper.toggled #page-content-wrapper {
position: relative;
margin-right: 0;
}
}
Have you added any extra CSS to this design, or only working off of the Bootstrap default CSS file?
If the latter, just go into that file and find the classes that reference the navbar and the sidebar, then take note of the position and margin elements.
The navbar is likely going to have a 'fixed' position, which is obvious being that it is stuck to the top of the page no matter the scroll position.
You probably want the sidebar to scroll with the rest of the page though, so you'll want to set the margins for the top of the sidebar div to 0. Then you want to set the position of the sidebar-wrapper div to 'absolute' if it's not already, then add the following:
left:0;
that should do it, but if not (depending on the div hierarchy), try adding the following as well:
top:[px height of navbar];
All you should need to do is remove the margin from the bottom of the .navbar which is 20px by default.
.navbar.navbar-default {
margin-bottom: 0;
}
See working Snippet.
$("#menu-toggle").click(function(e) {
e.preventDefault();
$("#wrapper").toggleClass("toggled");
});
.navbar.navbar-default {
margin-bottom: 0;
}
.navbar-brand>img {
max-height: 100%;
height: 100%;
width: auto;
margin: 0 auto;
/* probably not needed anymore, but doesn't hurt */
-o-object-fit: contain;
object-fit: contain;
}
#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: 250px;
}
#sidebar-wrapper {
z-index: 1000;
position: fixed;
left: 250px;
width: 0px;
height: 100%;
margin-left: -250px;
overflow-y: auto;
background: #000;
-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 #sidebar-wrapper {
width: 250px;
}
#page-content-wrapper {
width: 100%;
position: absolute;
padding: 15px;
}
#wrapper.toggled #page-content-wrapper {
position: absolute;
margin-right: -250px;
}
/* Sidebar Styles */
.sidebar-nav {
position: absolute;
top: 0;
width: 250px;
margin: 0;
padding: 0;
left: 0;
list-style: none;
}
.sidebar-nav li {
text-indent: 20px;
line-height: 40px;
}
.sidebar-nav li a {
display: block;
text-decoration: none;
color: #999999;
}
.sidebar-nav li a:hover {
text-decoration: none;
color: #fff;
background: rgba(255, 255, 255, 0.2);
}
.sidebar-nav li a:active,
.sidebar-nav li a:focus {
text-decoration: none;
}
.sidebar-nav > .sidebar-brand {
height: 65px;
font-size: 18px;
line-height: 60px;
}
.sidebar-nav > .sidebar-brand a {
color: #999999;
}
.sidebar-nav > .sidebar-brand a:hover {
color: #fff;
background: none;
}
#media(min-width:768px) {
#wrapper {
padding-left: 250px;
}
#wrapper.toggled {
padding-left: 0;
}
#sidebar-wrapper {
width: 250px;
}
#wrapper.toggled #sidebar-wrapper {
width: 0;
}
#page-content-wrapper {
padding: 20px;
position: relative;
}
#wrapper.toggled #page-content-wrapper {
position: relative;
margin-right: 0;
}
}
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.1/jquery.min.js"></script>
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/js/bootstrap.min.js"></script>
<link href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/css/bootstrap.min.css" rel="stylesheet" />
<nav class="navbar navbar-default">
<div class="container">
<div class="navbar-header">
<button type="button" class="navbar-toggle collapsed" data-toggle="collapse" data-target="#navbar" aria-expanded="false" aria-controls="navbar">
<!-- <span class="sr-only">Toggle navigation</span> -->
<span class="icon-bar"></span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
</button>
<a class="navbar-brand" href="http://disputebills.com">
<img src="http://disputebills.com/site/uploads/2015/10/dispute.png" alt="Dispute Bills">
</a>
</div>
<div id="navbar" class="collapse navbar-collapse">
<ul class="nav navbar-nav">
<li class="active">Home
</li>
<li>About
</li>
<li>Contact
</li>
</ul>
</div>
</div>
</nav>
</div>
<div id="wrapper">
<!-- Sidebar -->
<div id="sidebar-wrapper">
<ul class="sidebar-nav">
<li class="sidebar-brand">
<a href="#">
TER
</a>
</li>
<li>
</li>
<li>
</li>
<li>
</li>
<li>
</li>
<li>
</li>
<li>
</li>
<li>
</li>
</ul>
</div>
<!-- /#sidebar-wrapper -->
<!-- Page Content -->
<div id="page-content-wrapper">
<div class="container-fluid">
<div class="row">
<div class="panel panel-default">
<div class="panel-header">
<h1> TER</H1>
</div>
</div>
</div>
<div class="row">
<div class="col-lg-3 col-md-3">
<div class="panel panel-default">
<div class="panel-body">
<img src="images.jpg" class="img-circle " alt="Cinque Terre" width="200" height="200">
</div>
Toggle Menu
</div>
</div>
<div class="col-lg-6 col-md-6">
</div>
<div class="col-lg-3 col-md-3">
<h1>TER</h1>
<div class="panel panel-default">
</div>
</div>
</div>
</div>
</div>
<div id="charts-wrapper">
<div class="container-fluid">
<div class="row">
<div col="col-lg-3">
haha
</div>
</div>
</div>
</div>