How to adjust width of right-aligned navbar - css

Link to jsfiddle: https://jsfiddle.net/ckmmd5aL/
This is my bootstrap HTML
<div class="img-full">
<div class="container">
<nav class="navbar navbar-default">
<div class="container-fluid">
<div class="navbar-header">
<img class="img-responsive" src="images/oj_menu_heading.png" />
<!--a class="navbar-brand" href="#" style="color: white;">Parwest</a>
<a class="navbar-brand" href="#" style="color: white;">Group</a-->
</div>
<div id="navbar" class="navbar-collapse navbar-right collapse">
<ul class="nav navbar-nav">
<li><img class="img-responsive" src="images/oj_menu_organisation.png" style="width:80%; height:80%"/> <!--a href="#" style="color: white;">Organisation Profile</a-->
</li>
<li><img class="img-responsive" src="images/oj_menu_projects.png" style="width:80%; height:80%"/>
</li>
<li><img class="img-responsive" src="images/oj_menu_news.png" style="width:80%; height:80%"/>
</li>
<li><img class="img-responsive" src="images/oj_menu_contact.png" style="width:80%; height:80%"/>
</li>
</ul>
</div>
<!--/.nav-collapse -->
</div>
<!--/.container-fluid -->
</nav>
</div>
</div>
and this is the css
.img-full {
height: 450px;
background-image: url('images/oj_header.png');
background-repeat: no-repeat;
background-position: center;
background-size: 100%;
}
.navbar {
margin-top: 20px;
background: no-background;
}
.navbar.navbar-default {
background-color: transparent;
border-color: transparent;
}
and this gives me this result
but I want to reduce the gap between the right navbar items such that I get this layout
Can anyone please tell me how to reduce the gap and further right align the navbar items to get the required layout?
Any help would be appreciated. Thanks in advance.

I'd use Bootstrap's grid as it was intended.
<div class="col-sm-4">
Logo
</div>
<div class="col-sm-8">
Navbar
</div>
Demo
In addition, I've removed the nested container and applied top positioning to the background image.

Related

How to get 100% height and width of tab panel using bootstrap 4.3

I am using bootstrap 4.3. bootstrap 4.3 has sizing classes m-* and w-* to set the height and width of the element. I was able to get container's height and width to 100% and now I am trying to set 100% height and width of the tab-panel.
JSFiddle
<div class="container-fluid w-highlight-container h-100 d-flex flex-column">
<main role="main" class="pb-3">
<ul class="nav nav-tabs mt-3">
<li class="nav-item">
<a class="nav-link active" href="#w-tab1" data-toggle="tab" role="tab">Tab1</a>
</li>
<li class="nav-item">
<a class="nav-link" href="#w-tab2" data-toggle="tab" role="tab">Tab2</a>
</li>
</ul>
<div class="tab-content">
<div id="w-tab1" class="tab-pane fade active show" role="tabpanel">
<div class="row">
<div class="col-md-12">
<div class="w-tab1 h-100 w-100">
requires 100% height and 100% width of view port
</div>
</div>
</div>
</div>
<div id="w-tab2" class="tab-pane fade" role="tabpanel">
<div class="row">
<div class="col-md-12">
<div class="w-tab2 h-100 w-100">
requires 100% height and 100% width of view port
</div>
</div>
</div>
</div>
</div>
</main>
</div>
<footer class="border-top footer text-muted">
<div class="container">
© 2019 - UI - <a asp-area="" asp-controller="Home" asp-action="Privacy">Privacy</a>
</div>
</footer>
w-100 and h-100 are doing there job as intended, it is just that its parent container is not stretched 100% from side to side... so we start at tab-content and then ensure that 100% width and height is respected... right down to our relevant div which already has a w-100 and h-100 classes.
working code snippet below:
.w-tab1 {
border: solid 2px black;
background-color: green;
}
.w-tab2 {
border: solid 2px black;
background-color: red;
}
.w-highlight-container {
border: solid 2px black;
background-color: #ffd;
}
html,
body {
height: 100%;
}
.tab-content {
height: calc(100vh - (75px)) !important;
width: calc(100vw - (40px)) !important
}
.tab-content>.active {
display: inline-flex;
height: 100%;
width: 100%
}
.tab-content>.active>.row {
display: contents
}
.tab-content>.active>.row>div {
padding-left: 0;
width: 100%;
display: contents;
}
.tab-content>.active>.row>div>.w-100 {
width: 99% !important
}
<link href="https://stackpath.bootstrapcdn.com/bootstrap/4.3.1/css/bootstrap.min.css" rel="stylesheet" />
<script src="https://code.jquery.com/jquery-3.4.1.min.js"></script>
<script src="https://stackpath.bootstrapcdn.com/bootstrap/4.3.1/js/bootstrap.min.js"></script>
<div class="container-fluid w-highlight-container h-100 d-flex flex-column">
<main role="main" class="pb-3">
<ul class="nav nav-tabs mt-3">
<li class="nav-item">
<a class="nav-link active" href="#w-tab1" data-toggle="tab" role="tab">Tab1</a>
</li>
<li class="nav-item">
<a class="nav-link" href="#w-tab2" data-toggle="tab" role="tab">Tab2</a>
</li>
</ul>
<div class="tab-content">
<div id="w-tab1" class="tab-pane fade active show" role="tabpanel">
<div class="row">
<div class="col-md-12">
<div class="w-tab1 h-100 w-100">
requires 100% height and 100% width
</div>
</div>
</div>
</div>
<div id="w-tab2" class="tab-pane fade" role="tabpanel">
<div class="row">
<div class="col-md-12">
<div class="w-tab2 h-100 w-100">
requires 100% height and 100% width
</div>
</div>
</div>
</div>
</div>
</main>
</div>
<footer class="border-top footer text-muted">
<div class="container">
© 2019 - UI - <a asp-area="" asp-controller="Home" asp-action="Privacy">Privacy</a>
</div>
</footer>

How to make navbar-item dropdown always visible and active only with hover in bulma

In bulma navbar I have a logo on the left and one dropdown menu on the right. I want to make the menu always visible and only open on hover. Right now when the screen size in smaller than 1088px, the dropdown menu opens automatically on the right.
<nav class="navbar">
<div class="container">
<div class="navbar-brand is-expanded">
<a class="navbar-item" href="#">
<img src="img.png" width="131" height="35">
</a>
<div class="navbar-item has-dropdown is-hoverable">
<a class="navbar-link">
Docs
</a>
<div class="navbar-dropdown">
<a class="navbar-item">
Overview
</a>
<a class="navbar-item">
Elements
</a>
<a class="navbar-item">
Components
</a>
<hr class="navbar-divider">
<div class="navbar-item">
Version 0.7.1
</div>
</div>
</div>
</div>
</div>
</nav>
maybe this will help you
.navbar-dropdown {
background-color: white;
border-bottom-left-radius: 6px;
border-bottom-right-radius: 6px;
border-top: 2px solid #dbdbdb;
box-shadow: 0 8px 8px rgba(10, 10, 10, 0.1);
display: none;
font-size: 0.875rem;
left: 0;
min-width: 100%;
position: absolute;
top: 100%;
z-index: 20;
}
.navbar-item:hover .navbar-dropdown{
display: block;
}
#media screen and (max-width: 1088px){
.navbar-dropdown{
display: none;
}
}
<link rel="stylesheet" type="text/css" href="https://cdnjs.cloudflare.com/ajax/libs/bulma/0.7.1/css/bulma.css" media="all" />
<nav class="navbar">
<div class="container">
<div class="navbar-brand is-expanded">
<a class="navbar-item" href="#">
<img src="img.png" width="131" height="35">
</a>
<div class="navbar-item has-dropdown is-hoverable">
<a class="navbar-link">
Docs
</a>
<div class="navbar-dropdown">
<a class="navbar-item">
Overview
</a>
<a class="navbar-item">
Elements
</a>
<a class="navbar-item">
Components
</a>
<hr class="navbar-divider">
<div class="navbar-item">
Version 0.7.1
</div>
</div>
</div>
</div>
</div>
</nav>

how to make it responsive please ? bootstrap - css -html

im working on a portfolio website and i have a bug on my code, i want to put footer under card pricing. thank you.
https://i.stack.imgur.com/qYMvd.jpg
HTML :
FOOTER SECTION :
<footer class="footerP">
<div class="container-fluid">
<div class="row">
<div class="small-footer col-12 col-lg-12">
<div class="footer-title col-12 col-lg-6">
<h3>PASTEUR SERVICE STATION</h3>
</div>
<div class="footer-social hidden-md-down col-lg-6 text-right">
<ul id="menu">
<li>
<a href="#">
<i class="fab fa-facebook"></i>
</a>
</li>
<li>
<a href="#">
<i class="fab fa-twitter"></i>
</a>
</li>
<li>
<a href="#">
<i class="fab fa-google-plus-g"></i>
</a>
</li>
<li>
<a href="#">
<i class="fab fa-instagram"></i>
</a>
</li>
</ul>
</div>
</div>
<div class="big-footer">
</div>
</div>
</div>
</footer>
CSS CARD :
.card{
max-width: 300px;
height: auto;
border-radius: 15px;
padding: 40px 20px;
margin: 0 auto;
box-shadow: 0 10px 15px rgba(0, 0, 0, .4);
transition: .5s;
overflow: hidden;
}
FOOTER CSS :
.footerP .small-footer{
width: 100%;
height: 40px;
background: #232323;
}
thank you guys for help.
Wrap the whole thing in a footer tag and assign a class of "footer" (the Bootstrap default class).
<footer class="footer">
<div class="container-fluid">
<!--Rest of your code --!>
The default Bootstrap .footer will keep it full width and sticky to the bottom of the page.

Full-width background image in Bootstrap 3

I am able to create a full-width image background in Bootstrap 3. An example can be shown here:
body,
html {
height: 100%;
}
body {
padding-top: 50px;
}
.full {
padding: 0 !important;
margin: 0 auto !important;
background-size: cover;
overflow: hidden;
}
.wide {
width: 100%;
height: auto;
}
.logo {
color: #fff;
font-weight: 800;
font-size: 14pt;
padding: 25px;
text-align: center;
}
.line {
padding-top: 20px;
white-space: no-wrap;
overflow: hidden;
text-align: center;
}
<link href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css" rel="stylesheet" />
<div class="navbar navbar-inverse navbar-fixed-top">
<div class="container">
<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>
<a class="navbar-brand" href="#">Brand</a>
</div>
<div class="collapse navbar-collapse">
<ul class="nav navbar-nav">
<li class="active">Home
</li>
<li>About
</li>
</ul>
<ul class="nav navbar-nav navbar-right">
<li>Username
</li>
</ul>
</div>
<!--/.nav-collapse -->
</div>
</div>
<div class="full" style="background-image:url('https://c.stocksy.com/a/RcN300/z0/805779.jpg');">
<div class="container">
<div class="row clearfix">
<div style="padding: 0 0 200px 0;">
<div class="col-xs-5 line">
<hr>
</div>
<div class="col-xs-2 logo text-center">Logo</div>
<div class="col-xs-5 line">
<hr>
</div>
</div>
</div>
</div>
</div>
<div class="container">
<div class="text-center">
<h1>Content</h1>
</div>
</div>
<!-- /.container -->
When the page displays for Desktop, the image is shown wide covering entire area.
When the page displays for mobile, all the image now shows as if a zoom-out occurred.
What's this behavior? How can I make the image in mobile view look similar to the image displayed in desktop version?
Is this related to responsive imaging?
Thanks
/Bilal
This is caused by the standard behavior of cover. If you resize your desktop browser to a portrait like size, you'll see what I mean.
One option would be to use a media query, so when page is viewed in portrait mode, it will look somewhat better.
body,
html {
height: 100%;
}
body {
padding-top: 50px;
}
.full {
padding: 0 !important;
margin: 0 auto !important;
background-size: cover;
overflow: hidden;
}
.wide {
width: 100%;
height: auto;
}
.logo {
color: #fff;
font-weight: 800;
font-size: 14pt;
padding: 25px;
text-align: center;
}
.line {
padding-top: 20px;
white-space: no-wrap;
overflow: hidden;
text-align: center;
}
#media (orientation: portrait) {
.full {
background-size: 200% auto;
background-position: top right;
}
}
<link href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css" rel="stylesheet" />
<div class="navbar navbar-inverse navbar-fixed-top">
<div class="container">
<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>
<a class="navbar-brand" href="#">Brand</a>
</div>
<div class="collapse navbar-collapse">
<ul class="nav navbar-nav">
<li class="active">Home
</li>
<li>About
</li>
</ul>
<ul class="nav navbar-nav navbar-right">
<li>Username
</li>
</ul>
</div>
<!--/.nav-collapse -->
</div>
</div>
<div class="full" style="background-image:url('https://c.stocksy.com/a/RcN300/z0/805779.jpg');">
<div class="container">
<div class="row clearfix">
<div style="padding: 0 0 400px 0;">
<div class="col-xs-5 line">
<hr>
</div>
<div class="col-xs-2 logo text-center">Logo</div>
<div class="col-xs-5 line">
<hr>
</div>
</div>
</div>
</div>
</div>
<div class="container">
<div class="text-center">
<h1>Content</h1>
</div>
</div>
<!-- /.container -->

Bootstrap creating extra padding on column in row

Let me preface this by saying I am relatively new to bootstrap and possibly not udnerstanding the row/column layouts properly.
The layout I am working on can be seen here: http://jsfiddle.net/5NFXY/ (code pasted below)
The 'sidebar' on the right is where the problem is occurring. I have a .col-md-9 and a .col-md-3 enclosed withing a .row, but for some reason the right side of the sidebar is not lining up properly with its container. After playing around with this for quite some time I have found that if I remove margin-right: -15px; from the .row the problem goes away, but surely this isn't' the proper solution and I have mucked something up along the way. My question is, have I done something wrong in my HTML or is the proper solution really to manually override that margin-right: -15px;?
HTML
<body>
<div class="container">
<div class="logo-header">
<h1>Header</h1>
<h4>Subheader</h4>
</div>
<div class="inner-container clearfix">
<!-- Static navbar -->
<div class="navbar navbar-default" role="navigation">
<div class="navbar-header">
<button type="button" class="navbar-toggle" data-toggle="collapse" data-target=".navbar-collapse">
<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="navbar-collapse collapse">
<ul class="nav navbar-nav">
<li class="dropdown">
Operations <b class="caret"></b>
<ul class="dropdown-menu">
<li class="dropdown-header">Get Started</li>
<li>Start New</li>
<li>View All</li>
<li class="divider"></li>
<li class="dropdown-header"> Settings</li>
<li>Manage Types</li>
<li>Manage Types</li>
</ul>
</li>
<li class="dropdown">
Utilities <b class="caret"></b>
<ul class="dropdown-menu">
<li>Forums</li>
<li class="divider"></li>
<li>Distance</li>
</ul>
</li>
<li class="dropdown">
Administration <b class="caret"></b>
<ul class="dropdown-menu">
<li>News</li>
</ul>
</li>
</ul>
<ul class="nav navbar-nav navbar-right">
<li class="dropdown">
Alts <b class="caret"></b>
<ul class="dropdown-menu">
<li>1</li>
<li>2</li>
</ul>
</li>
</ul>
</div><!--/.nav-collapse -->
</div>
<div class="row">
<div class="col-md-9">
<div class="wrath-content-box news-post">
<h1>Title Bar</h1>
<p>This example is a quick exercise to illustrate how the default, static navbar and fixed to top navbar work. It includes the responsive CSS and HTML, so it also adapts to your viewport and device.</p>
<p>
<a class="btn btn-lg btn-primary" href="" role="button">View navbar docs »</a>
</p>
</div>
<div class="wrath-content-box news-post">
<h1>Title Bar</h1>
<p>This example is a quick exercise to illustrate how the default, static navbar and fixed to top navbar work. It includes the responsive CSS and HTML, so it also adapts to your viewport and device.</p>
<p>
<a class="btn btn-lg btn-primary" href="" role="button">View navbar docs »</a>
</p>
</div>
<div class="wrath-content-box news-post">
<h1>Title Bar</h1>
<p>This example is a quick exercise to illustrate how the default, static navbar and fixed to top navbar work. It includes the responsive CSS and HTML, so it also adapts to your viewport and device.</p>
<p>
<a class="btn btn-lg btn-primary" href="" role="button">View navbar docs »</a>
</p>
</div>
<div class="wrath-content-box news-post">
<h1>Title Bar</h1>
<p>This example is a quick exercise to illustrate how the default, static navbar and fixed to top navbar work. It includes the responsive CSS and HTML, so it also adapts to your viewport and device.</p>
<p>
<a class="btn btn-lg btn-primary" href="" role="button">View navbar docs »</a>
</p>
</div>
</div>
<div class="col-md-3 wrath-content-box">
<h1>Title Bar</h1>
<p>This example is a quick exercise to illustrate how the default, static navbar and fixed to top navbar work. It includes the responsive CSS and HTML, so it also adapts to your viewport and device.</p>
<p>
<a class="btn btn-lg btn-primary" href="" role="button">View navbar docs »</a>
</p>
</div>
</div>
<footer class="wrath-content-box">
Footer tagline ©
</footer>
</div> <!-- /inner-container -->
</div> <!-- /container -->
</body>
CSS
body {
padding-top: 20px;
padding-bottom: 20px;
background: url('../img/wh-background-1.jpg') center center no-repeat fixed;
-webkit-background-size: cover;
-moz-background-size: cover;
-o-background-size: cover;
background-size: cover;
}
.navbar {
margin-bottom: 20px;
}
.logo-header {
color: #FFF;
}
.logo-header h1 {
margin-bottom: 0;
}
.logo-header h4 {
margin-top: 0;
margin-bottom: 20px;
}
footer {
margin-top: 20px;
}
.inner-container {
background: rgba(119, 119, 119, .5);
border-radius: 6px;
padding: 20px;
}
.wrath-content-box {
border-color: #e7e7e7;
background-color: #f8f8f8;
border-radius: 6px;
padding: 15px;
}
.news-post {
margin-bottom: 20px;
}
Using: Bootstrap 3.0.3 + Jquery 1.10.1
You've combined your custom class wrath-content-box with the bootstrap col-md-3 class and the padding on your class is overriding the Bootsrap grid padding.
You just need to put your class in a separate <div> inside the bootstrap one like you did in the first column.
<div class="col-md-3">
<div class="wrath-content-box">
...
</div>
</div>
Demo

Resources