How to fix Bootstrap browser resizing? - html

I am trying to create a simple three column layout. I just cant figure how to make the divs work properly when resizing the browser. I can probably make it work if I used #media queries, but I want to use Bootstrap framework. The text spills out when resizing, as I have given a fixed div height. If I don't give a fixed height, the size of the divs become uneven when resizing browser.
I also have to list (unordered list) 1-3 links, which makes the alignment go wonky when resizing the browser. Here is the link the Codepen link,
https://codepen.io/ArshRai/pen/xyxmEJ
HTML:
<div class="container-fluid">
<div class="row ">
<div class="col-lg" id="setup-mini-card">
<div class="row align-items-start">
<div class="col col-lg-4">
<div class="tile-sm pt-4">
<div class="col col-md-6">
<img class="mr-auto pt-3" src="https://webiconspng.com/wp-content/uploads/2017/02/Photograph-Transparent-Icon.png" />
</div>
<div class="col-md-6 ml-5" style="display: table; height: 90px;overflow: hidden;" >
<div class="tile-sm-link">
<ul class="tile-sm-list">
<li>Lorem ipsum dolor </li>
</ul>
</div>
</div>
</div>
</div>
<div class="col-md-4 ">
<div class="tile-sm pt-4">
<div class="col-md-6">
<img class="mr-auto pt-3" src="https://webiconspng.com/wp-content/uploads/2017/02/Photograph-Transparent-Icon.png" />
</div>
<div class="col-md-6 ml-5" style="display: table; height: 90px;overflow: hidden;" >
<div class="tile-sm-link">
<ul class="tile-sm-list">
<li>Lorem ipsum dolor </li>
<li>Lorem ipsum dolor </li>
</ul>
</div>
</div>
</div>
</div>
<div class="col-md-4">
<div class="tile-sm pt-4">
<div class="col-md-6">
<img class="mr-auto pt-3" src="https://webiconspng.com/wp-content/uploads/2017/02/Photograph-Transparent-Icon.png" />
</div>
<div class="col-md-6 ml-5" style="display: table; height: 90px;overflow: hidden;" >
<div class="tile-sm-link">
<ul class="tile-sm-list">
<li><a href="">Lorem ipsum dolor </li>
<li>Lorem ipsum dolor </li>
<li>Lorem ipsum dolor </li>
</ul>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
CSS:
#setup-mini-card {
padding-top: 60px;
}
.tile-sm-txt {
vertical-align: text-bottom;
padding-left: 10px;
}
.tile-sm {
height: 130px;
margin-bottom: 20px;
border-radius: 5px;
/* text-align: center;*/
box-shadow: 0 4px 8px 0 rgba(0, 0, 0, 0.2), 0 6px 20px 0 rgba(0, 0, 0, 0.19);
padding: 30px
}
.tile-sm:hover
{
box-shadow: 0 4px 4px rgba(0, 200, 149, .24), 0 0 4px rgba(0, 173, 147, .12), 0 6px 18px rgba(0, 145, 147, .12);
transform: translate3d(0, -2px, 0);
text-decoration: none;
}
.tile-sm > a:hover {
color:#fff !important;
}
.tile-sm > div img {
float:left;
width:60px;
}
.tile-sm-list {
list-style: none;
}
.tile-sm-link {
display: table-cell; vertical-align: middle;
}

Make sure you nested the bootstrap row correctly. I'm doing a sample and hopefully, it would help you a little on how to use Bootstrap grid if this is the direction you are wanting to move forward
.tomato{
background: tomato
}
.yellow{
background: yellow
}
.green{
background: green
}
.nested{
padding: 15px;
}
.image{
background-color: blue
}
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0/css/bootstrap.min.css">
<!-- Columns start at 100% wide on mobile and bump up to 33.3% wide on desktop -->
<div class="container">
<div class="row">
<div class="col-12 col-md-4 yellow">
<!--Nested-->
<div class="row nested">
<div class="col-5 image">
</div>
<div class="col-7 tomato">
<ul>
<li>Lorem ipsum dolor </li>
<li>Lorem ipsum dolor </li>
</ul>
</div>
</div>
</div>
<div class="col-12 col-md-4 green">.col-12 .col-md-4</div>
<div class="col-12 col-md-4 yellow">.col-12 .col-md-4</div>
</div>
</div>

Depending on your aim you could change the overflow property as shown below.
overflow:hidden;
or
overflow:auto;
.tile-sm{
height: 130px;
margin-bottom: 20px;
border-radius: 5px;
/* text-align: center;*/
box-shadow: 0 4px 8px 0 rgba(0, 0, 0, 0.2), 0 6px 20px 0 rgba(0, 0, 0, 0.19);
padding: 30px;
overflow:auto;
}
or
.tile-sm{
height: 130px;
margin-bottom: 20px;
border-radius: 5px;
/* text-align: center;*/
box-shadow: 0 4px 8px 0 rgba(0, 0, 0, 0.2), 0 6px 20px 0 rgba(0, 0, 0, 0.19);
padding: 30px;
overflow: hidden;
}

Related

Horizontally centre '::before' item and other div element with flex concept in Bootstrap 4

.status-light-red::before{
background-color: rgb(255, 0, 0);
box-shadow: 0px 0px 5px 2px rgb(255 0 0 / 75%);
-webkit-box-shadow: 0px 0px 5px 2px rgb(255 0 0 / 75%);
-moz-box-shadow: 0px 0px 5px 2px rgb(255 0 0 / 75%);
}
.status-light::before{
content: "";
height: 10px;
width: 10px;
position: absolute;
border-radius: 50%;
top:50%;
}
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/bootstrap#4.3.1/dist/css/bootstrap.min.css">
<div class="container py-5">
<div class="row job-list-view-section">
<div class="col-12">
<div class="d-flex justify-content-between align-items-center border border-dark my-shadow p-4">
<div>
<span>1</span>
</div>
<div>
<p>Company Name</p>
</div>
<div>
<p>Applied Job For</p>
</div>
<div>
<p>status</p>
</div>
<div class="status-light status-light-red"></div>
</div>
</div>
</div>
</div>
I am using here bootstrap 4.3.1 with flex concept with some custom pieces of CSS. Here the status-light and other div items are not proper center horizontally, how am I doing center horizontally?
Note: Don't want a solution by adding custom top property value (Ex. top:58%; or top:58px;), I need a proper logical solution.
You might use vertical translation to bring it up in line with the text elements. Notice that I stripped out the span and paragraph elements which don't seem to be doing anything.
.status-light-red::before{
background-color: rgb(255, 0, 0);
box-shadow: 0px 0px 5px 2px rgb(255 0 0 / 75%);
}
.status-light::before{
content: "";
height: 10px;
width: 10px;
position: absolute;
border-radius: 50%;
transform: translateY(-50%);
}
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/bootstrap#4.3.1/dist/css/bootstrap.min.css">
<div class="container py-5">
<div class="row job-list-view-section">
<div class="col-12">
<div class="d-flex justify-content-between align-items-center border border-dark my-shadow p-4">
<div>1</div>
<div>Company Name</div>
<div>Job Applied For</div>
<div>Status</div>
<div class="status-light status-light-red"></div>
</div>
</div>
</div>
</div>
You can give the p the same line-height as the container - here I added some borders and padding just to be painfully obvious what is where.
I also made some p into a div because that seems "cleaner" given your requirement.
.job-list-view-section {
border: 2px blue solid;
padding: 0.25rem;
}
.job-list-view-section .col-12 {
border: 1px red solid;
padding: 0.25rem;
}
.job-list-view-section .col-12 .d-flex {
padding: 0.25rem;
}
.job-list-view-section .col-12 .my-shadow>* {
border: 1px green solid;
display: flex;
align-items: center;
justify-content: center;
height:3rem;
}
.job-list-view-section .col-12 .my-shadow>*>p {
background-color: #ddffdd;
display: inline-block;
align-self: flex-start;
line-height: 2.9rem; /*match to align text in the p to the green box, less than 3 for the borders */
}
.wrap-things {
width: 3rem;
height: 3rem;
display: flex;
align-items: center;
justify-content: center;
border: solid 1px lime;
align-self: center;
}
.status-light {
border: solid 1px lime;
height: 0.5rem;
width: 0.5rem;
}
.status-light-red::before {
background-color: rgb(255, 0, 0);
box-shadow: 0px 0px 5px 2px rgb(255 0 0 / 75%);
-webkit-box-shadow: 0px 0px 5px 2px rgb(255 0 0 / 75%);
-moz-box-shadow: 0px 0px 5px 2px rgb(255 0 0 / 75%);
}
.status-light::before {
content: "";
border-radius: 50%;
}
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0/css/bootstrap.min.css">
<div class="container py-5">
<div class="row job-list-view-section">
<div class="col-12">
<div class="d-flex justify-content-between align-items-center border border-dark my-shadow p-4">
<div>
<span>1</span>
</div>
<div>
<div>Company Name</div>
</div>
<div>
<p>Applied Job For</p>
</div>
<div>
<div>status</div>
</div>
<div class="wrap-things">
<div class="status-light status-light-red"></div>
</div>
</div>
</div>
</div>
</div>
See, borders:
.status-light-red::before{
background-color: rgb(255, 0, 0);
box-shadow: 0px 0px 5px 2px rgb(255 0 0 / 75%);
-webkit-box-shadow: 0px 0px 5px 2px rgb(255 0 0 / 75%);
-moz-box-shadow: 0px 0px 5px 2px rgb(255 0 0 / 75%);
}
.status-light::before{
content: "";
height: 10px;
width: 10px;
position: absolute;
border-radius: 50%;
top:50%;
}
.my-shadow >div{border: solid 1px red;}
.my-shadow >div>p{border: solid 1px lime;}
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/bootstrap#4.3.1/dist/css/bootstrap.min.css">
<div class="container py-5">
<div class="row job-list-view-section">
<div class="col-12">
<div class="d-flex justify-content-between align-items-center border border-dark my-shadow p-4">
<div>
<span>1</span>
</div>
<div>
<p>Company Name</p>
</div>
<div>
<p>Applied Job For</p>
</div>
<div>
<p>status</p>
</div>
<div class="status-light status-light-red"></div>
</div>
</div>
</div>
</div>
Remove the padding from <p>.
Also, to align the red dot add top: calc(50% - 5px); to ::before.
See MDN calc.
.status-light-red::before{
background-color: rgb(255, 0, 0);
box-shadow: 0px 0px 5px 2px rgb(255 0 0 / 75%);
-webkit-box-shadow: 0px 0px 5px 2px rgb(255 0 0 / 75%);
-moz-box-shadow: 0px 0px 5px 2px rgb(255 0 0 / 75%);
}
.status-light::before{
content: "";
height: 10px;
width: 10px;
position: absolute;
border-radius: 50%;
top: calc(50% - 5px);
}
.job-list-view-section p{
margin-bottom: 0;
}
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0/css/bootstrap.min.css">
<div class="container py-5">
<div class="row job-list-view-section">
<div class="col-12">
<div class="d-flex justify-content-between align-items-center border border-dark my-shadow p-4">
<div>
<span>1</span>
</div>
<div>
<p>Company Name</p>
</div>
<div>
<p>Applied Job For</p>
</div>
<div>
<p>status</p>
</div>
<div class="status-light status-light-red"></div>
</div>
</div>
</div>
</div>
also, you could try displaying the parent flex like
.status-light-red::before {
background-color: rgb(255, 0, 0);
box-shadow: 0px 0px 5px 2px rgb(255 0 0 / 75%);
-webkit-box-shadow: 0px 0px 5px 2px rgb(255 0 0 / 75%);
-moz-box-shadow: 0px 0px 5px 2px rgb(255 0 0 / 75%);
}
.status-light{
display: flex;
align-items: center;
justify-content: center;
}
.status-light::before{
content: "";
height: 10px;
width: 10px;
position: absolute;
border-radius: 50%;
/*top pos removed*/
}
.job-list-view-section p {
margin-bottom: 0;
}
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0/css/bootstrap.min.css">
<div class="container py-5">
<div class="row job-list-view-section">
<div class="col-12">
<div class="d-flex justify-content-between align-items-center border border-dark my-shadow p-4">
<div>
<span>1</span>
</div>
<div>
<p>Company Name</p>
</div>
<div>
<p>Applied Job For</p>
</div>
<div>
<p>status</p>
</div>
<div class="status-light status-light-red"></div>
</div>
</div>
</div>
</div>

bootstrap right block over left block on mobile view

I have 2 blocks using bootstrap grid system.
On mobile view, I want the right block above the left one. The right block should also occupy 100% width of the screen.
My code so far:
<style>
.block {
border-radius: 8px;
box-shadow: 0 0 8px 4px rgba(0,0,0,0.1);
padding: 25px;
}
.block2 {
border-radius: 8px;
box-shadow: 0 0 8px 4px rgba(0,0,0,0.1);
}
</style>
<div class="container checkoutform">
<form class="row mx-n2">
<div class="col-sm-8 px-2">
<div class="block">
<!-- code -->
</div>
</div>
<div class="col-sm-4 px-2">
<div class="block2">
<!-- code -->
</div>
</div>
</form>
</div>
I have no idea how to proceed. Any help would be greatly appreciated
Try adding width: 100%; to the .block2 and .block style rules.
As well, try to switch the places of the block and block2 div elements.
It should be looking like that:
The CSS:
.block {
border-radius: 8px;
box-shadow: 0 0 8px 4px rgba(0,0,0,0.1);
padding: 25px;
width: 100%;
}
.block2 {
border-radius: 8px;
box-shadow: 0 0 8px 4px rgba(0,0,0,0.1);
width: 100%;
}
And the HTML:
<div class="container checkoutform">
<form class="row mx-n2">
<div class="col-sm-8 px-2">
<div class="col-sm-4 px-2">
<div class="block2">
<!-- code -->
</div>
</div>
<div class="col-sm-8 px-2">
<div class="block">
<!-- code -->
</div>
</div>
</form>
</div>
Please let me know if it worked!

Circular picture same width and height auto scaling the images

I'm trying to create a card like structure where I want to display and image and some text.
This is my result:
I like most of the result, it just bothers me that not all images have this 5rem x 5rem size.
How can I solve this?
It would appear that the width / height of the .card-img-holder does not always fit 5x5.
.card {
box-shadow: 0 1px 3px rgba(0, 0, 0, 0.12), 0 1px 2px rgba(0, 0, 0, 0.24);
transition: all 0.3s cubic-bezier(.25, .8, .25, 1);
padding: .5rem;
margin: .5rem;
flex: 1 1 0px;
}
.card-img-holder {
width: 5rem;
height: 5rem;
}
.card-img {
width: 100%;
height: 100%;
object-fit: contain;
box-shadow: 0 1px 3px rgba(0, 0, 0, 0.12), 0 1px 2px rgba(0, 0, 0, 0.24);
border-radius: 50%;
}
.card-img-name {
padding: .5rem;
}
.card-img-name p:first-of-type {
font-size: 1rem;
font-weight: bold;
}
<!-- Jest -->
<div class="card">
<div class="flex-container centered">
<div class="card-img-holder">
<img src="https://picsum.photos/335/150" alt="Jest" class="card-img" />
</div>
<div class="card-img-name">
<p>Jest</p>
<p>Testing</p>
</div>
</div>
<div>
Website
</div>
</div>
<!-- React -->
<div class="card">
<div class="flex-container centered">
<div class="card-img-holder">
<img src="https://picsum.photos/350" alt="React" class="card-img" />
</div>
<div class="card-img-name">
<p>React</p>
<p>Frontend Library</p>
</div>
</div>
<div>
Website
</div>
</div>
<!-- Git -->
<div class="card">
<div class="flex-container centered">
<div class="card-img-holder">
<img src="https://picsum.photos/63/150" alt="Git" class="card-img" />
</div>
<div class="card-img-name">
<p>Git</p>
<p>Version Control</p>
</div>
</div>
<div>
Website
</div>
</div>

How to give spacing between elements inside a row

I have an angular 10 project, where I have to align 3 cards in a row, so far they align horizontally in a row, but I have to give them some spacing which did not work that much till now.
I tried to do it with offset variable of bootstrap and manually giving them margin and padding but still no luck. In mobile phone it works perfectly fine with spacing just not in desktop. Here is my code could someone look at it and point me my mistake out?
What I tried so far:
setting margin and padding manually -> did not work no effect at
all.
using offset variable of bootstrap -> no changes.
using flex parameter -> also no changes
card component.html
<section>
<div class="row ">
<div class="col-xl-4 col-md-4 my-4 ">
<mdb-card cascade="true" class="cascading-admin-card">
<div class="admin-up">
<mdb-icon fas icon="money-bill-alt" class="primary-color"></mdb-icon>
<div class="data">
<p>SALES</p>
<h4><strong>$2000</strong></h4>
</div>
</div>
<mdb-card-body [cascade]="true">
<div class="progress">
<div class="progress-bar bg-primary" role="progressbar" style="width: 25%" aria-valuenow="25"
aria-valuemin="0" aria-valuemax="100"></div>
</div>
<p class="card-text">Better than last week (25%)</p>
</mdb-card-body>
</mdb-card>
</div>
</div>
</section>
my scss for this component:
.cascading-admin-card {
margin-top: 20px;
float: left;
width:18rem;
}
.cascading-admin-card .admin-up {
margin-left: 4%;
margin-right: 4%;
margin-top: -20px;
padding-top: 5px;
}
.cascading-admin-card .admin-up mdb-icon {
padding: 1.7rem;
font-size: 2rem;
color: #fff;
text-align: left;
margin-right: 1rem;
border-radius: 3px;
box-shadow: 0 2px 9px 0 rgba(0,0,0,.2),0 2px 13px 0 rgba(0,0,0,.19); }
.cascading-admin-card .admin-up .data {
float: right;
margin-top: 2rem;
text-align: right; }
.cascading-admin-card .admin-up .data p {
color: #999999;
font-size: 12px; }
.classic-admin-card .card-body {
color: #fff;
margin-bottom: 0;
padding: 0.9rem; }
.classic-admin-card .card-body p {
font-size: 13px;
opacity: 0.7;
margin-bottom: 0; }
.classic-admin-card .card-body h4 {
margin-top: 10px; }
.classic-admin-card .card-body .float-right .fa {
font-size: 3rem;
opacity: 0.5; }
.classic-admin-card .progress {
margin: 0;
opacity: 0.7; }
.cascading-admin-card .admin-up .fa {
-webkit-box-shadow: 0 2px 9px 0 rgba(0, 0, 0, 0.2), 0 2px 13px 0 rgba(0, 0, 0, 0.19);
box-shadow: 0 2px 9px 0 rgba(0, 0, 0, 0.2), 0 2px 13px 0 rgba(0, 0, 0, 0.19);
}
And the main dashboard where I use this element:
<div class="main-content justify-content-center" style="padding-top: 50px; align-content: center">
<div class="container">
<div class="row row-cols-12 row-cols-md-3">
<div class="col mb-4">
<moniesta-client-card-info></moniesta-client-card-info>
</div>
<div class="col mb-4">
<moniesta-client-card-info></moniesta-client-card-info>
</div>
<div class="col mb-4">
<moniesta-client-card-info></moniesta-client-card-info>
</div>
</div>
</div>
</div>
Here is the images of what I get when I give my code flex:
and this is mobile:
I want to achieve two things first in desktop I want the cards to start next with a bit of space to the sidebar.
And be responsive
My code looks like this:
<div class="main-content " style="padding-top: 50px; align-content: center">
<div class="container">
<div class="d-inline-flex">
<section class="col-4">
<div >
<moniesta-client-card-info></moniesta-client-card-info>
</div>
</section>
<section class="col-4">
<div >
<moniesta-client-card-info></moniesta-client-card-info>
</div>
</section>
<section class="col-4">
<div >
<moniesta-client-card-info></moniesta-client-card-info>
</div>
</section>
</div>
</div>
</div>
Your question needs improvements.
As long as your question concerns a CSS or HTML issue, try to provide the compiled expected result as HTML, without your angular formatting.
I do not know how your angular component is acting. So I maybe made some errors in my interpretation below. However, I suggest you to learn how bootstrap cards are built.
Here is an example with header, body and footer within card :
<div class="card text-center">
<div class="card-header">
My header
</div>
<div class="card-body">
<h5 class="card-title">A title in the body</h5>
<p class="card-text">A card text</p>
</div>
<div class="card-footer text-muted">
A text in footer which is muted
</div>
</div>
Then in your row component, you have 3 col elements, where you bind your cards. You may consider moving the mb-4 class to the row wrapper, and removing it from your cols.
Then in your card component, I think you have too much rules, and may consider clarifying it. Have a look on my interpretation below. I made the first card a little bit different than the two others to let you see how a bootstrap card could be implemented.
See your code with the built-in stackoverflow js/html/css snippet
.cascading-admin-card {
margin-top: 20px;
float: left;
width:18rem;
}
.cascading-admin-card .admin-up {
margin-left: 4%;
margin-right: 4%;
margin-top: -20px;
padding-top: 5px;
}
.cascading-admin-card .admin-up mdb-icon {
padding: 1.7rem;
font-size: 2rem;
color: #fff;
text-align: left;
margin-right: 1rem;
border-radius: 3px;
box-shadow: 0 2px 9px 0 rgba(0,0,0,.2),0 2px 13px 0 rgba(0,0,0,.19); }
.cascading-admin-card .admin-up .data {
float: right;
margin-top: 2rem;
text-align: right; }
.cascading-admin-card .admin-up .data p {
color: #999999;
font-size: 12px; }
.classic-admin-card .card-body {
color: #fff;
margin-bottom: 0;
padding: 0.9rem; }
.classic-admin-card .card-body p {
font-size: 13px;
opacity: 0.7;
margin-bottom: 0; }
.classic-admin-card .card-body h4 {
margin-top: 10px; }
.classic-admin-card .card-body .float-right .fa {
font-size: 3rem;
opacity: 0.5; }
.classic-admin-card .progress {
margin: 0;
opacity: 0.7; }
.cascading-admin-card .admin-up .fa {
-webkit-box-shadow: 0 2px 9px 0 rgba(0, 0, 0, 0.2), 0 2px 13px 0 rgba(0, 0, 0, 0.19);
box-shadow: 0 2px 9px 0 rgba(0, 0, 0, 0.2), 0 2px 13px 0 rgba(0, 0, 0, 0.19);
}
<html>
<head>
<link href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/5.15.1/css/all.min.css" rel="stylesheet"/>
<script src="https://stackpath.bootstrapcdn.com/bootstrap/4.5.2/js/bootstrap.min.js"></script>
<link href="https://stackpath.bootstrapcdn.com/bootstrap/4.5.2/css/bootstrap.min.css" rel="stylesheet"/>
</head>
<body>
<div class="main-content justify-content-center" style="padding-top: 15px; align-content: center">
<div class="container">
<div class="row">
<div class="col">
<div class="card cascading-admin-card">
<div class="card-header">
<i class="fas fa-money-bill-alt primary-color"></i>
SALES
</div>
<div class="card-body">
<h5 class="card-title">$2000</h5>
<div class="progress">
<div class="progress-bar bg-primary" role="progressbar" style="width: 25%" aria-valuenow="25"
aria-valuemin="0" aria-valuemax="100"></div>
</div>
</div>
<div class="card-footer text-muted">
Better than last week (25%)
</div>
</div>
</div>
<div class="col">
<div class="card cascading-admin-card">
<div class="admin-up">
<i class="fas fa-money-bill-alt primary-color"></i>
<div class="data">
<p>SALES</p>
<h4><strong>$2000</strong></h4>
</div>
</div>
<div class="card-body">
<div class="progress">
<div class="progress-bar bg-primary" role="progressbar" style="width: 25%" aria-valuenow="25"
aria-valuemin="0" aria-valuemax="100"></div>
</div>
<p class="card-text">Better than last week (25%)</p>
</div>
</div>
</div>
<div class="col">
<div class="card cascading-admin-card">
<div class="admin-up">
<i class="fas fa-money-bill-alt primary-color"></i>
<div class="data">
<p>SALES</p>
<h4><strong>$2000</strong></h4>
</div>
</div>
<div class="card-body">
<div class="progress">
<div class="progress-bar bg-primary" role="progressbar" style="width: 25%" aria-valuenow="25"
aria-valuemin="0" aria-valuemax="100"></div>
</div>
<p class="card-text">Better than last week (25%)</p>
</div>
</div>
</div>
</div>
</div>
</div>
</body>
</html>

Vertical align image inside of h-100 column

I'm trying to vertical center an image in bootstrap 4. The nav bar should be a fixed height(100px) and the columns should also have a height of 100px, because they have a background.
I'm using align-items-center class but it doesn't seem to be working, the image stays at the top.
.navbar-brand {
height: 100px;
padding-top: .75rem;
padding-bottom: .75rem;
font-size: 1rem;
background-color: rgba(0, 0, 0, .25);
box-shadow: inset -1px 0 0 rgba(0, 0, 0, .25);
}
.navbar {
box-shadow: inset 0 -1px 0 rgba(0, 0, 0, .1);
background-color: #3366cc;
height: 100px;
}
<link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/4.1.3/css/bootstrap.min.css" integrity="sha384-MCw98/SFnGE8fJT3GXwEOngsV7Zt27NXFoaoApmYm81iuXoPkFOJwJ8ERdknLPMO" crossorigin="anonymous">
<nav class="navbar sticky-top p-0">
<div class="container-fluid h-100" style="border-bottom: 1px solid rgb(192, 192, 192); height:100px;">
<div class="row justify-content-between align-items-center h-100" style="width:100vw;">
<div class="col-2 col-xxxl-1 h-100" style="background:white;">
<img class="img-fluid" style="max-height: 100px" src="https://via.placeholder.com/350x150" alt="" />
</div>
<div class="col-2 col-xxxl-1 text-center" style="background: white;height: 100%;">
<p class="no-wrap"> Sign out</p>
</div>
</div>
</div>
</nav>
I believe this is what you are looking for -
1) Removing h-100 from the inner div does the fix aligns the content in the middle.
2) By changing the markup - added a div with class col-8 which will serve as the blue middle section.
.navbar-brand {
height: 100px;
padding-top: .75rem;
padding-bottom: .75rem;
font-size: 1rem;
background-color: rgba(0, 0, 0, .25);
box-shadow: inset -1px 0 0 rgba(0, 0, 0, .25);
}
.navbar {
box-shadow: inset 0 -1px 0 rgba(0, 0, 0, .1);
height: 100px;
}
.middle-nav {
background-color: #3366cc;
width: 100%;
height: 100px;
}
<!-- Latest compiled and minified CSS -->
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/4.3.1/css/bootstrap.min.css">
<!-- jQuery library -->
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script>
<!-- Popper JS -->
<script src="https://cdnjs.cloudflare.com/ajax/libs/popper.js/1.14.7/umd/popper.min.js"></script>
<!-- Latest compiled JavaScript -->
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/4.3.1/js/bootstrap.min.js"></script>
<nav class="navbar sticky-top p-0">
<div class="container-fluid h-100" style="border-bottom: 1px solid rgb(192, 192, 192); height:100px;">
<div class="row justify-content-between align-items-center" style="width:100vw;">
<div class="col-2 col-xxxl-1 h-100" style="background: white;">
<img class="img-fluid" style="max-height: 100px" src="https://via.placeholder.com/350x150" alt="" />
</div>
<div class="col-8 middle-nav"></div>
<div class="col-2 col-xxxl-1 text-center" style="background: white;height: 100%;">
<p class="no-wrap"> Sign out</p>
</div>
</div>
</div>
</nav>
You did not include what the align-items-center class is doing so it's hard to tell what might be happening.
Just adding the align-items-center class to the CSS with a text-align: center; can center the image.
.navbar-brand {
height: 100px;
padding-top: .75rem;
padding-bottom: .75rem;
font-size: 1rem;
background-color: rgba(0, 0, 0, .25);
box-shadow: inset -1px 0 0 rgba(0, 0, 0, .25);
}
.navbar {
box-shadow: inset 0 -1px 0 rgba(0, 0, 0, .1);
background-color: #3366cc;
height: 100px;
}
.align-items-center {
text-align: center;
}
<nav class="navbar sticky-top p-0">
<div class="container-fluid h-100" style="border-bottom: 1px solid rgb(192, 192, 192); height:100px;">
<div class="row justify-content-between align-items-center h-100" style="width:100vw;">
<div class="col-2 col-xxxl-1 h-100" style="background:white;">
<img class="img-fluid" style="max-height: 100px" src="https://via.placeholder.com/350x150" alt="" />
</div>
<div class="col-2 col-xxxl-1 text-center" style="background: white;height: 100%;">
<p class="no-wrap"> Sign out</p>
</div>
</div>
</div>
</nav>