This is a pretty funky issue.
I'm trying to create an frameless app using electron and bootstrap 4 and wanted to style the app a bit.
After a lot of work, I came by the most odd of issues I have encountered in the entire project.
This is not an electron issue tho (hence the lack of the relevant tag).
You see, I have a header element that is 87px height (to contain the navbar and window controls like maximize and close), with a main element under it that contains the actual content of the page.
<header>
<div class="window-control bg-primary">
<button class="btn btn-primary btn-sm float-right" (click)="exitApp()"><fa-icon [icon]="faTimes"></fa-icon></button>
<button class="btn btn-primary btn-sm float-right" *ngIf="isMaximized" (click)="unmaximizeWindow()"><fa-icon [icon]="faMinusSquare" ></fa-icon></button>
<button class="btn btn-primary btn-sm float-right" *ngIf="!isMaximized" (click)="maximizeWindow()"><fa-icon [icon]="faPlusSquare" ></fa-icon></button>
<button class="btn btn-primary btn-sm float-right" (click)="minimizeWindow()"><fa-icon [icon]="faMinus"></fa-icon></button>
</div>
<nav class="navbar navbar-expand navbar-dark bg-secondary">
<div class="container-fluid">
<a class="navbar-brand" href="#">
<span class="text-primary font-weight-bold">9</span>AnimeDl
</a>
<ul class="nav navbar-nav mr-auto">
<li class="nav-item"><a class="nav-link" href="#">Discover</a></li>
</ul>
<form class="form-inline my-2 my-lg-0 mr-2">
<div class="input-group">
<input class="form-control bg-secondary border-0 text-center" aria-describedby="basic-addon1" type="search" placeholder="Search" aria-label="Search" #search (keyup)="searchChange(search.value)">
<div class="input-group-append">
<button class="btn btn-outline-primary bg-secondary text-white" type="button">
<fa-icon [icon]="faSearch"></fa-icon>
</button>
</div>
</div>
</form>
<button class="btn btn-primary" (click)="doDonate()">Donate</button>
</div>
</nav>
</header>
<app-donate-modal *ngIf="nagDonation"></app-donate-modal>
<app-waf-captcha *ngIf="_9anime.isWafActive" [siteKey]="_9anime.siteKey"></app-waf-captcha>
<main [hidden]="!isBusy" class="container-fluid bg-gray-dark">
<div class="content">
<app-loading-spinner></app-loading-spinner>
</div>
</main>
<main [hidden]="isBusy" class="container-fluid bg-gray-dark">
<router-outlet></router-outlet>
</main>
Now I added the following css to my stylesheet:
body {
overflow: hidden;
height: 100%;
}
main {
height: 100%;
padding-top: 25px;
position: absolute;
overflow-y: scroll;
}
.window-control {
height: 31px;
-webkit-app-region: drag;
-webkit-user-select: none;
button {
-webkit-app-region: none;
}
}
::-webkit-scrollbar {
width: 12px; /* for vertical scrollbars */
height: 12px; /* for horizontal scrollbars */
}
::-webkit-scrollbar-track {
background: map-get($theme-colors, "gray-dark");
}
::-webkit-scrollbar-thumb{
background: map-get($theme-colors, "primary");
}
::-webkit-resizer {
display: none;
}
This causes the "regular" scrollbar to be gone from the body and slams it into the main element
Now, here is the funky part.
When I remove the header (display: none) and scroll all the way down this is what I get:
The scrollbar reaches the bottom and says put, the cards show fully with a small padding at the bottom.
Now when I add the header back in again and scroll all the way down, this happens:
The cards don't fully show, there is no padding under it (like in the first screenshot) and the scrollbar scrolls farther than it should scroll.
My question is if anyone knows what is causing this issue and, more importantly, how to solve it.
solved it by adding an 87px thick border on the bottom of the content:
main {
border-bottom: 87px solid #ccc;
}
Related
I'm struggling to stretch the left navigation section to reach the bottom of the page and stay responsive. I'm using Bootstrap 5.2.0. I tried many solutions like h-100, flex-grow, min-vh-100m self-align: stretch. Nothing seems to do the trick.
Codepen: (You may have to increase the height of the output window to see what I mean) :
https://codepen.io/ma66ot/pen/KKQZXew
HTML
<div class="col-md-3 col-lg-2">
<div class="logo">
<div>
<img src="https://upload.wikimedia.org/wikipedia/commons/thumb/a/a0/Circle_-_black_simple.svg/300px-Circle_-_black_simple.svg.png" id="circle" alt="">
</div>
</div>
<div class="row">
<div class="col-md-12">
<div class="navigation ">
<div class="title-nav">
<img src="./assets/verwaltung.png" alt="" id="verwaltung-logo">
</div>
<div class="button-container">
<ul>
<li><button type="button" class="btn btn-primary btn-lg btn-block">Übersicht</button></li>
<li><button type="button" class="btn btn-primary btn-lg btn-block">TrainerInnen</button></li>
<li><button type="button" class="btn btn-primary btn-lg btn-block">TeilnehmerInnen</button></li>
<li><button type="button" class="btn btn-primary btn-lg btn-block">Gruppen</button></li>
</ul>
</div>
</div>
</div>
</div>
</div>
<div class="col-md-9 col-lg-10">
<div class="mainfenster">
</div>
</div>
</div>
</div>
</div>
CSS
h2 {
width:100%;
}
html button {
border: 0;
width: 100%;
}
html ul {
list-style-type: none;
padding: 0;
margin: 0;
}
html .container-fluid {
padding: 1em;
}
#circle{
width: 100%;
height: 100%;
}
#verwaltung-logo {
width: 50%;
height: 50%;
}
html .links {
padding-right: 3em;
}
/* Navigation */
html .navigation {
background: #FFA500;
border-radius: 48px;
padding: 1em;
margin-top: 1em;
}
li {
margin-top: 1em;
margin-bottom: 1em;
}
.button-container{
width: 80%;
margin: auto;
}
.navigation a {
color: white;
text-decoration: none;
}
.mainfenster {
background: #FF6E13;
border-radius: 48px;
overflow-y: scroll;
height: calc(100vh - 2em);;
}
/* Hide scrollbar for Chrome */
.mainfenster::-webkit-scrollbar {
display: none;
}
.mainfenster {
/* Hide scrollbar for IE, Edge and Firefox */
-ms-overflow-style: none; /* IE and Edge */
scrollbar-width: none; /* Firefox */
}
.mainfenster button {
border-radius: 10px !important;
}
As explained here anytime you want to fill or stretch the remaining height flexbox column direction and flex grow.
make the left column viewport height and use min-vh-100
also make the left column d-flex flex-column
use flex-grow-1 on the div you want to fill the remaining column height
finally, use h-100 on the navigation so it fills the height of its' parent
https://codeply.com/p/CqV3FF1x5L
<div class="container-fluid ">
<div class="row">
<div class="col-md-3 col-lg-2 min-vh-100 d-flex flex-column">
<div class="logo">
<div>
<img ...>
</div>
</div>
<div class="row flex-grow-1">
<div class="col-md-12">
<div class="navigation h-100">
<div class="title-nav">
<img .. >
</div>
<div class="button-container">
<ul>
<li><button type="button" class="btn btn-primary btn-lg btn-block">Übersicht</button></li>
<li><button type="button" class="btn btn-primary btn-lg btn-block">TrainerInnen</button></li>
<li><button type="button" class="btn btn-primary btn-lg btn-block">TeilnehmerInnen</button></li>
<li><button type="button" class="btn btn-primary btn-lg btn-block">Gruppen</button></li>
</ul>
</div>
</div>
</div>
</div>
</div>
<div class="col-md-9 col-lg-10">
<div class="mainfenster">
</div>
</div>
</div>
</div>
First you need to fix height of left logo after that you need to add height to .navigation class and minus height of logo. see the below exmple
html .navigation {
height: calc(100vh - 200px);
}
In this above case your logo div height 200px.
Problem:
I'm trying to create a HTML from which will have two buttons and a text in the middle. Everything looks fine just the right button is being pushed a little down. What is causing this in my HTML mockup?
I would appreciate any kind of help.
Code:
<div class="card-body p-0">
<ul class="nav nav-sidebar" data-nav-type="accordion">
<li class="nav-item-header">headline</li>
<li class="nav-item" style=" margin: 0px 20px 0px 20px;">
<button type="button" class="btn btn-primary btn-icon" style="left: 20px !important; position:absolute !important;"><i class="icon-arrow-left12"></i></button>
<p style="text-align: center;">Text</p>
<button type="button" class="btn btn-primary btn-icon" style="right: 20px !important; position:absolute !important;"><i class="icon-arrow-right13"></i></button>
</li>
</ul>
</div>
Image to demonstrate the problem:
You've put your text inside a <p> paragraph - so that means it will push everything after it to below it.
Try this: https://jsfiddle.net/px7u04aL/
Even without style sheet css - it shows side by side as I think you wanted.
Agree with comment from Martin that it is best not to use absolute unless you really have to.
Try the following code:-
Add CSS property position: relative; in the second li and add top: 0px in right button.
<div class="card-body p-0">
<ul class="nav nav-sidebar" style="position: relative" data-nav-type="accordion">
<li class="nav-item-header">headline</li>
<li class="nav-item" style="position: relative; margin: 0px 20px 0px 20px;">
<button type="button" class="btn btn-primary btn-icon" style="left: 20px !important; position:absolute !important;"><i class="icon-arrow-left12"></i></button>
<p style="text-align: center;">Text</p>
<button type="button" class="btn btn-primary btn-icon" style="right: 20px !important;top: 0px; position:absolute !important;"><i class="icon-arrow-right13"></i></button>
</li>
</ul>
</div>
I don't know why, my navbar isn't centered. My buttons aren't aligned at the center and I want to change the navbar height.
How I could do that? This is the navbar:
And this is the code:
.extra-margin {
margin-bottom: 1%;
}
.extra-padding{
padding-top: 1%;
}
.extra-button{
margin-left: 5%;
}
<link href="https://stackpath.bootstrapcdn.com/bootstrap/4.0.0/css/bootstrap.min.css" rel="stylesheet"/>
<header>
<nav class="navbar navbar-dark bg-dark navbar-fixed-top extra-margin">
<ul>
<a class="btn btn-outline-primary" href="{% url 'interface:users' %}">Lista Pacientes</a>
<a class=" btn btn-outline-success" href="{% url 'interface:users' %}">Añadir Paciente</a>
<a class=" btn btn-outline-danger" href="{% url 'interface:users' %}">Eliminar Paciente</a>
</ul>
<form class="navbar-form navbar navbar-right extra-padding" action="{% url 'interface:users' %}" method="post">
{% csrf_token %}
<div class="input-group">
<input type="text" name="search_text" class="form-control" placeholder="ID del Paciente">
<div class="input-group-btn">
<button class="btn btn-outline-warning extra-button" type="submit"> Buscar Paciente
</button>
</div>
</div>
</form>
</nav>
</header>
To put the buttons inline use the following style change:
nav ul
{
margin: 0;
}
In default, the ul has some bottom margin.
https://www.bootply.com/ruS4ad9IoW
You have to change this in your CSS using the #navbar-height.
When you create the navbar have a minimum of 50px.
Now about vertical centered you can use vertical-align: middle; and change the margin to 0 in the ul element, normally ul have a margin
I am trying to create a page header / tool bar. This in an existing theme and there is a DIV at the top where this will reside. The basic premise is on the left a H2 title then on the right a bunch of bootstrap elements (search form, bottons, dropdowns etc.
I have tried all kinds of block, inline-block vertical-align etc. I can get the H2 to pull left and the toolbar to pull right but the toolbar elements all pull up to the top of the container div. I just want a clean looking layout with all the elements aligned along their horizontal axis.
I think the pull-right may be part of the problem. That seems to pull the right div up to the top.
Here is a Bootply link: http://www.bootply.com/BPucyP8mpk
<div class"container">
<div id="left">
<h2 class="">Title</h2>
</div>
<div id="right">
<form class="form form-horizontal">
<input type="text" placeholder="search field" class="form-control">
<button type="submit" class="btn">search</button>
</form>
<button class="btn btn-default">Button</button>
<div class="btn-group">
<button class="btn">Left</button>
<button class="btn">Middle</button>
<button class="btn">Right</button>
</div>
<div class="btn-group"><a class="btn dropdown-toggle" data-toggle="dropdown" href="#">Dropdown<span class="caret"></span></a>
<ul class="dropdown-menu">
<li>Choice1
</li>
<li>Choice2
</li>
<li>Choice3
</li>
<li class="divider"></li>
<li>Choice..
</li>
</ul>
</div>
</div>
</div>
UPDATE:
Here is the computed CSS that wraps the header I am trying to format:
border-bottom-width: 1px;
border-top-color: rgb(103, 106, 108);
border-top-style: none;
border-top-width: 0px;
box-sizing: border-box;
color: rgb(103, 106, 108);
display: block;
font-family: 'Open Sans', 'Helvetica Neue', Helvetica, Arial, sans-serif;
font-size: 13px;
height: 70px;
line-height: 18px;
margin-left: -15px;
margin-right: -15px;
padding-bottom: 12px;
padding-left: 20px;
padding-right: 20px;
padding-top: 0px;
width: 1318px;
This is from my custom theme I have installed. This is the computed CSS from this wrapper div:
<div class="row wrapper border-bottom white-bg page-heading">
</div>
UPD:
The most suitable method for this task is use Flexbox
Check it out: http://www.bootply.com/CtVmUbzrlr
<div class="row">
<div id="left" class="col-sm-3 col-md-5">
<h2 class="">Title</h2>
</div>
<div id="right" class="col-sm-9 col-md-7">
<form class="form form-horizontal">
<div class="input-group">
<input type="text" placeholder="search field" class="form-control">
<span type="submit" class="input-group-addon">search</span>
</div>
</form>
<button class="btn btn-default">Button</button>
<div class="btn-group">
<button class="btn">Left</button>
<button class="btn">Middle</button>
<button class="btn">Right</button>
</div>
<div class="btn-group"><a class="btn dropdown-toggle" data-toggle="dropdown" href="#">Dropdown<span class="caret"></span></a>
<ul class="dropdown-menu">
<li>Choice1
</li>
<li>Choice2
</li>
<li>Choice3
</li>
<li class="divider"></li>
<li>Choice..
</li>
</ul>
</div>
</div>
</div>
.row{
border: 1px solid #000;
}
#right{
display: flex;
align-items: center;
height: 66px;
justify-content: flex-end;
}
.input-group{
width: 200px;
}
Check this out:
<div class="col-lg-4">
<h2 class="">Title</h2>
</div>
<div class="col-lg-8">
<div class="row">
<form class="form form-horizontal">
<div class="col-lg-8">
<input type="text" placeholder="search field" class="form-control">
</div>
<div class="col-lg-4">
<button type="submit" class="btn btn-block">search</button>
</div>
</form>
</div>
<div class="row">
<div class="col-lg-12">
<button class="btn btn-default">Button</button>
<div class="btn-group">
<button class="btn">Left</button>
<button class="btn">Middle</button>
<button class="btn">Right</button>
</div>
<div class="btn-group"><a class="btn dropdown-toggle" data-toggle="dropdown" href="#">Dropdown<span class="caret"></span></a>
<ul class="dropdown-menu">
<li>Choice1
</li>
<li>Choice2
</li>
<li>Choice3
</li>
<li class="divider"></li>
<li>Choice..
</li>
</ul>
</div>
</div>
</div>
</div>
you can check bootply also : http://www.bootply.com/LmGjZM6fHH
You need to manage your layout with the col-md-*
This is just for the demo, you can arrange with you own way
What about utilizing the navbar component from bootstrap?
http://getbootstrap.com/components/#navbar
I think the example here pretty much sums up your needs.
Basically I've added classes navbar-btn to the buttons, and navbar-form to the form to get them to align properly. I added the class navbar-right to both the form and the group of buttons.
http://www.bootply.com/IySnkX2ioK
Edit: The navbar-default class was just added to outline the bounds of the navbar, not part of the solution.
First thing is that if you want to have your search box on left - place it first and then button group with dropdown. Second, don't place navbar-rigth inside another navbar-rigth. And the last thing - just wrap your right-side elements in one div and add to it a little padding
Updated link
I am doing a design for mobile and I have to think in differents devices. I put a button-group in bottom of the page. It's means the bottons appear at the final of the scroll-bar. But, when the page its too small because the device is big, the bottons appear at the middle of the page. And after that, there is white space.
I try with this rules: How to put the footer at the bottom of the visible page? But the buttons appear always at the bottom of the screen. I need see the bottons after using scroll-bar.
HTML
<div id="botoneraInternet" class="btn-group btn-group-justified" role="group" aria-label="...">
<div class="btn-group btn-group-lg" role="group">
<button type="button" class="btn btn-default" id="botonHardware" disabled="" style="background-color: rgb(48, 144, 184);">
<span><img class="icons" src="imagenes/llave.png"></span> Hardware
</button>
</div>
<div class="btn-group btn-group-lg" role="group">
<button type="button" class="btn btn-default" id="botonClose" style="background-color: rgb(223, 228, 229);">
<span><img class="icons" src="imagenes/valija.png"></span> Cerrar WO
</button>
</div>
</div>
CSS
.btn-group {
position: relative;
vertical-align: middle;
}
.btn-group-justified {
display: table;
width: 100%;
table-layout: fixed;
border-collapse: separate;
}
Someone can help me?
Really thanks, and I am going to give the star to the best answer.
try this....there wasn't enought code you provided so I improvised a bit. But let me know if this is what you need.
http://codepen.io/carinlynchin/pen/WvbLXE
CSS:
body{
height:900px;
position:relative;
}
.btn-group {
position: absolute;
width:100%;
bottom:0
}
.btn-group div {
display:inline;
}
HTML:
<div id="botoneraInternet" class="btn-group btn-group-justified" role="group" aria-label="...">
<div role="group">
<button type="button" class="btn btn-default" id="botonHardware" disabled="" style="background-color: rgb(48, 144, 184);">
<span><img class="icons" src="http://barkpost-assets.s3.amazonaws.com/wp-content/uploads/2013/11/grumpy-dog-11.jpg"></span> Hardware
</button>
</div>
<div role="group">
<button type="button" class="btn btn-default" id="botonClose" style="background-color: rgb(223, 228, 229);">
<span><img class="icons" src="https://pbs.twimg.com/profile_images/3540744128/7dd80644ae052f1b04180c41bbc674ab.png"></span> Cerrar WO
</button>
</div>
</div>