How to achieve this layout with Bootstrap 3 - css

I was wondering if someone knows how I cam accomplish this using Bootstrap 3 while not hacking it.
As you can see from the picture below I'd like to have an inverted navbar at the top. Underneath I'd like to have a bar with black bg that only goes so far (for instance 4 columns with dark bg and the remaining 8 columns with light bg). That's the easy part. The problem I've found is how have the container bg have different colour of background.
At the moment I have this:
That's been achieved using this code:
<div class="navbar navbar-inverse navbar-fixed-top">
<div class="container nt-container">
<div class="nt-header-top row">
<div class="col-md-4">
<h1 class="nt-logo">New Project</h1>
</div>
<div class="col-md-8 text-right">
<h3>Some slogan here</h3>
</div>
</div>
<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="row">
<div class="col-md-2">
<ul class="nav navbar-nav">
<li class="active"><span class="glyphicon glyphicon-home"></span></li>
<li><span class="glyphicon glyphicon-list"></span></li>
<li><span class="glyphicon glyphicon-envelope"></span></li>
</ul>
</div>
<div class="col-md-10 nt-top-title-bar">
<section class="row">
<div class="col-md-8 more-padding-left">
<h2 class="">Some slogan here</h2>
</div>
<div class="col-md-4 text-right">
<ul class="nav navbar-nav navbar-right">
<li class="active"><span class="glyphicon glyphicon-home"></span></li>
<li><span class="glyphicon glyphicon-list"></span></li>
<li><span class="glyphicon glyphicon-envelope"></span></li>
</ul>
</div>
</section>
</div>
</div>
</div>
<div class="container nt-container">
<div class="row">
<section class="col-md-2 nt-side-menu-section">
<ul class="list-group">
...
</ul>
</section>
<div class="col-md-5 more-padding-left">
<h2>Heading 1</h2>
<p>...</p>
</div>
<div class="col-md-5">
<h2>Heading</h2>
<p>...</p>
</div>
</div>
<hr>
<footer>
<p>© Company 2013</p>
</footer>
I though maybe I could add div on the right gutter with a light background on top of the container background, but I thought this very hackish and inelegant.
Any suggestions on how to achieve this?

Ok...if I have this right the element in question has a class of .nt-top-title-bar.
You can do this with a pseudo element by adding:
.nt-top-title-bar:after {
content: "";
position: absolute;
background: insert your color here; /* Match the background of menubar*/
top: 0;
bottom: 0;
width: 9999px; /* some huge width */
left: 100%;
}
Codepen Example
CSS-Tricks Reference

Related

How to header nav bar align using bootstrap css

I am trying to show below look but not working.I have added all css and js but not working.
How to align properly nav bar and logo for mobile view and desktop and tap.
Demo: https://stackblitz.com/edit/angular-7-bootstrap-navbar-ujihha?file=src/styles.css
header.component.html:
<div id="page">
<header class="header-container">
<div class="container">
<div class="top-row">
<div class="row">
<div class="col-md-2 col-sm-6 col-xs-6">
<div id="logo">
<!--<img src="images/logo.png" alt="logo">-->
<span>Resort</span>
</div>
</div>
<div class="col-sm-6 visible-sm">
<div class="text-right"><button type="button" class="book-now-btn">Book Now</button></div>
</div>
<div class="col-md-8 col-sm-12 col-xs-12 remove-padd">
<nav class="navbar navbar-default">
<div class="navbar-header page-scroll">
<button data-target=".navbar-ex1-collapse" data-toggle="collapse" class="navbar-toggle" type="button">
<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 navigation navbar-collapse navbar-ex1-collapse remove-space">
<ul class="list-unstyled nav1 cl-effect-10">
<li><a data-hover="Home" class="active"><span>Home</span></a></li>
<li><a data-hover="About" href="about.html"><span>About</span></a></li>
<li><a data-hover="Rooms" href="rooms.html"><span>Rooms</span></a></li>
<li><a data-hover="Gallery" href="gallery.html"><span>Gallery</span></a></li>
<li><a data-hover="Contact Us" href="contact.html"><span>contact Us</span></a></li>
</ul>
</div>
</nav>
</div>
<div class="col-md-2 col-sm-4 col-xs-12 hidden-sm">
<div class="text-right"><button type="button" class="book-now-btn">Book Now</button></div>
</div>
</div>
</div>
</div>
</header>
<!--back to top--->
<a style="display: none;" href="javascript:void(0);" class="scrollTop back-to-top" id="back-to-top">
<span><i aria-hidden="true" class="fa fa-angle-up fa-lg"></i></span>
<span>Top</span>
</a>
</div>

Bootstrap Toggle shows up on medium size screen

Using Bootstrap 4.3 to make a responsive dashboard, I ran into a problem with medium screens. When I resize Google chrome to check the page in different sizes, sadly, the bootstrap toggle button appears when chrome is resized to medium. This is the case with other browsers as well. The following picture is my chrome showing the page. As in the picture, the screen is not that small for the content to disappear and for the toggle button to show up:
The followings are my codes. I would be really grateful if you help me solve the problem.
#media (max-width: 768px) {
.sidebar {
position: static;
height: auto;
}
.top-navbar {
position: static;
}
}
.top-nav-height {
height: 3em!important;
}
.sidebar {
box-sizing: border-box;
background-color: #34495e !important;
height: 100vh;
}
<body dir="rtl">
<!-- Navigation -->
<nav class="navbar navbar-expand-lg navbar-light p-0 m-0">
<button class="navbar-toggler" type="button" data-toggle="collapse" data-target="#goNavBar" aria-controls="goNavBar" aria-expanded="false" aria-label="Toggle navigation">
<span class="navbar-toggler-icon"></span>
</button>
<div class="collapse navbar-collapse" id="goNavBar">
<div class="container-fluid">
<div class="row">
<!-- Sidebar -->
<div class="col-md-2 col-xl-2 col-md-5 sidebar p-0 m-0">
ِDashboard
<div id="NavBarParent">
<ul class="navbar-nav flex-column">
<li class="nav-item rtl d-block">
<i class="fas fa-home ml-2"></i>Home
</li>
</ul>
</div>
</div>
<!-- Sidebar Done -->
<!-- Top Bar -->
<div class="col-md-10 col-xl-10 col-md-7 py-3 top-navbar">
<div class="row align-items-center">
<div class="col-md-4 col-sm-4 col-lg-5 col-xl-5">
<h4></h4>
</div>
<div class="col-md-5 col-sm-4 col-lg-5 col-xl-5">
</div>
<div class="col-md-3 col-sm-4 col-lg-2 col-xl-2" >
<ul class="navbar-nav">
<li><span class="fa-layers fa-fw fa-lg" >
<i class="fas fa-envelope py-1" style="color: #34495e"></i>
<span class="fa-layers-counter fa-lg bullet-sizing">45</span>
</span></li>
<li><span class="fa-layers fa-fw fa-lg mr-2" >
<i class="fas fa-bell py-1" style="color: #34495e"></i>
<span class="fa-layers-counter bullet-sizing fa-lg">2</span>
</span></li>
<li class="nav-item mr-auto"><i class="fas fa-sign-out-alt fa-lg" style="color: #34495e"></i></li>
</ul>
</div>
</div>
</div>
<!-- Top Bar Done -->
</div>
</div>
</div>
</nav>
<!-- Navigation Done -->
For the sake of convenience, I deleted some lines from sidebar menu items, as I think they don't have anything to do with the sizing and toggle button.
Wow, the problem was on the very first line. Changing the 'navbar-expand-lg' on the first line of code into 'navbar-expand-sm' solved my issue.
You need to change navbar-expand-(value)Ex lg/md/sm or custom.you can try this i have added with your code.
<body dir="rtl">
<!-- Navigation -->
<nav class="navbar navbar-expand-md navbar-light p-0 m-0">
<button class="navbar-toggler" type="button" data-toggle="collapse" data-target="#goNavBar" aria-controls="goNavBar" aria-expanded="false" aria-label="Toggle navigation">
<span class="navbar-toggler-icon"></span>
</button>
<div class="collapse navbar-collapse" id="goNavBar">
<div class="container-fluid">
<div class="row">
<!-- Sidebar -->
<div class="col-md-2 col-xl-2 col-md-5 sidebar p-0 m-0">
ِDashboard
<div id="NavBarParent">
<ul class="navbar-nav flex-column">
<li class="nav-item rtl d-block">
<i class="fas fa-home ml-2"></i>Home
</li>
</ul>
</div>
</div>
<!-- Sidebar Done -->
<!-- Top Bar -->
<div class="col-md-10 col-xl-10 col-md-7 py-3 top-navbar">
<div class="row align-items-center">
<div class="col-md-4 col-sm-4 col-lg-5 col-xl-5">
<h4></h4>
</div>
<div class="col-md-5 col-sm-4 col-lg-5 col-xl-5">
</div>
<div class="col-md-3 col-sm-4 col-lg-2 col-xl-2" >
<ul class="navbar-nav">
<li><span class="fa-layers fa-fw fa-lg" >
<i class="fas fa-envelope py-1" style="color: #34495e"></i>
<span class="fa-layers-counter fa-lg bullet-sizing">45</span>
</span></li>
<li><span class="fa-layers fa-fw fa-lg mr-2" >
<i class="fas fa-bell py-1" style="color: #34495e"></i>
<span class="fa-layers-counter bullet-sizing fa-lg">2</span>
</span></li>
<li class="nav-item mr-auto"><i class="fas fa-sign-out-alt fa-lg" style="color: #34495e"></i></li>
</ul>
</div>
</div>
</div>
<!-- Top Bar Done -->
</div>
</div>
</div>
</nav>
<!-- Navigation Done -->

Bootstrap dropdown inside accordion

I have an Accordion which has a header, inside which I need to place a dropdown menu. I've tried fiddling with the z-index thinking it was a stacking issue to no avail. I've reproduced the issue with a minimal sample at https://www.bootply.com/53bH05eQlf
Is there any way to get the dropdown menu to display correctly?
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script>
<div class="accordion">
<div class="card">
<div class="card-header">Blah</div>
</div>
<div class="card">
<div class="card-header">Blah</div>
</div>
<div class="card">
<div class="card-header">Blah
<div class="dropdown text-center show border-info border rounded menu-button float-left">
<a class="btn p-0 dropdown-toggle" href="#" role="button" id="some-dropdown" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">
<span class="fa fa-bars"></span>
</a>
<ul class="dropdown-menu dropdown-menu-right" aria-labelledby="some-dropdown">
<li class="dropdown-item">Hidden behind the card!</li>
</ul>
</div>
</div>
</div>
<div class="card">
<div class="card-header">Blah</div>
</div>
<div class="card">
<div class="card-header">Blah</div>
</div>
</div>
Adding style="overflow: visible" to the card div which contains the dropdown will solve the issue.
That is, for the bootply example replace <div class="card"> on line 8 with <div class="card" style="overflow: visible">.

How to get jumbotron colour to also cover navbar

I'm trying to get a picture (below I've tested with a single background color) to cover the navbar aswell as the showcase/jumbotron. However I can't get it to cover both correctly and the navbar is left untouched - even if I create a div that surround the navbar and jumbotron and assign a background picture to this.
Additionally when I try a picture it is stretched in a rather random way across the showcase, how do I get this to cover the elements correctly ?(image size is 1400x693 svg).
<header class="nav-header">
<nav class="navbar navbar-expand-md navbar-light bg-light">
<div class="container">
<span class="navbar-brand"><i>Logo</i></span>
<button class="navbar-toggler" type="button" data-toggle="collapse" data-target="#navbar-collapse"
aria-controls="navbar-collapse" aria-expanded="false" aria-label="Toggle navigation">
<span class="navbar-toggler-icon"></span>
</button>
<div class="navbar-collapse collapse">
<ul class="nav navbar-nav ml-auto">
<li class="nav-item"><a class="nav-link" href="#">How it works</a></li>
</ul><!--//nav-->
<ul class="nav navbar-nav ml-auto">
<li class="nav-item">
<a class="nav-link" href="#">My Profile</a>
</li>
<li class="nav-item">
<a class="btn btn-outline-success" href="#">Log out</a>
</li>
</ul>
</div>
</div>
</nav><!--//header-->
</header>
<section>
<div class="showcase">
<div class="container">
<div class="jumbotron jumbotron-fluid showcase-content text-white">
<div class="row">
<div class="col-lg-6">
<h2 class="display-4">Some title.</h2>
<p class="lead">Some additional showcase text.</p>
<p>
<a class="btn btn-secondary text-white " href="#">Get Started -></a>
</p>
</div>
<div class="col-lg-6">
<image></image>
</div>
</div>
</div>
</div><!--//container-->
</div>
</section><!--//promo-->
Css
.showcase {
background-color: red;
background-size: cover;
}
.nav-header {
background-color: transparent;
}
.showcase-content {
background-color: transparent;
}
Codepen:
https://codepen.io/anon/pen/vjqvEE
The issue was having bg-light within the navbar which was overriding assigning the colour to the navbar too.

Bootstrap navbar with logo and text

I'm trying to create a boostrap navbar with a small square logo on the left, text (company name) to the right, and then navbar on far right. Here's code so far, I just can't figure out how to add the text.
When it goes down to XS, I need the logo and text to remain on the same line. So, I made the logo image a full width transparent PNG (to hold the column in place) and tried to add text to the right of the logo (still over the transparent part) but I can't figure this out.
Any help would be great. Here's code so far:
<div class="header">
<div class="container">
<div class="row">
<div class="col-md-5 col-sm-5">
<div class="logo"><div style="height:50px; width:150px; position:absolute; border:solid 1px red;"></div><a href="<?php echo site_url(); ?>/"><img src="<?php echo get_template_directory_uri(); ?>/images/logo_small.png"
class="img-responsive"></a></div>
</div>
<div class="col-md-7 col-sm-7 hidden-xs">
<!-- Navbar Start Here -->
<div role="navigation" class="navba-r navbar-default">
<div class="navbar navbar-default" role="navigation">
<div class="navbar-header">
<a class="navbar-brand" href="#"></a>
</div>
<nav role="navigation" class="collapse navbar-collapse navbar-left">
<ul class="navbar-nav nav aa">
<li>COMPANY</li>
<li>PEOPLE</li>
<li>PATIENTS</li>
<li>CONTACT</li>
</ul>
</nav>
</div>
</div>
<!-- Navbar End Here -->
</div>
</div>
</div>
</div>
I put together a fiddle for you. I included the logo and title inside the nav. The key was adding the class pull-left to the href around the image.
https://jsfiddle.net/msm6jozL/7/
<div class="container">
<nav class="navbar navbar-default">
<div class="container-fluid">
<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="logo pull-left" href="#"><img src="https://placehold.it/150x30"></a>
<span class="name pull-left">COMPANY NAME</span>
</div>
<div id="navbar" class="navbar-collapse collapse">
<ul class="nav navbar-nav navbar-right">
<li>COMPANY</li>
<li>PEOPLE</li>
<li>PATIENTS</li>
<li>CONTACT</li>
</ul>
</div>
</div>
</nav>
</div>
.logo {
padding: 10px 10px 0 10px;
}
.name {
font-size: 14px;
color: #333;
padding-top: 15px;
}

Resources