Bootstrap 5 Tabs is not opening correctly - html

I want to make Vertical bootstrap tabs but when I tried to use the code from bootstrap 5 docs I faced a problem when opening the tabs as you can see in the screenshot the tabs are showing next to each other when I switch between them so what I'm missing in this
]
code
<div class="d-flex align-items-start center rounded" style="direction: rtl;">
<div class="nav flex-column nav-pills me-3" id="v-pills-tab" role="tablist" aria-orientation="vertical">
<button class="btn btn-lg btn-primary" id="v-pills-home-tab" data-bs-toggle="pill" data-bs-target="#v-pills-home"
type="button" role="tab" aria-controls="v-pills-home" aria-selected="true">Home</button>
<button class="btn btn-lg btn-primary dflex" id="v-pills-profile-tab" data-bs-toggle="pill"
data-bs-target="#v-pills-profile" type="button" role="tab" aria-controls="v-pills-profile"
aria-selected="false">Store</button>
</div>
<div class="tab-content" id="v-pills-tabContent">
<div class="tab-pane fade show active" id="v-pills-home" role="tabpanel" aria-labelledby="v-pills-home-tab">
<div class="container contain bg-light rounded">
<div class="row" style="direction:rtl;">
<h4 class="title" >Home</h4><br>
</div><hr />
<div class="row" style="direction:rtl;">
<div class="card cashIncom shadow-lg p-3 mb-5 bg-white rounded">
<div class="card-body" style="width:750px;">
<div class="mb-1">
<div class="d-inline-flex align-items-center">
<span class="spanIncome">إجمالي الأرباح :</span>
<span class="spanValue" id="spanIncomeValue">500$</span>
<i class="fa-solid fa-credit-card iconstate"></i>
</div>
</div>
</div>
</div>
</div>
<div class="row" style="direction:rtl;">
<div class="card cashIncom shadow-lg p-3 mb-5 bg-white rounded">
<div class="card-body" style="width:750px;">
<div class="mb-1">
<div class="d-inline-flex align-items-center">
<span class="spanIncome">المصروفات :</span>
<span class="spanValuespent" id="spanIncomeValue">500$</span>
<i class="fa-solid fa-dollar-sign spenticon"></i>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>

Related

How to make bootstrap columns automatically resize when element overflows them

I have a BootStrap 5 row, the columns of which will always remain the same, even if the content inside of them overflows the column. How do I make it so that when content is larger than the column, the column expands in size?
As you can see, the columns (purple) let the cards inside of them overflow, therefore causing them to collide with other cards. What I want is for the columns to expand when the content inside of them is bound to overflow.
HTML for rows and columns:
<div class="row">
<div class="col">
<h1 class="header">User</h1>
<div class="card card-large border-0 me-1">
<div class="card-body shadow">
<div class="row row-cols-2">
<div class="col" style="text-align: left; margin-left: 15px; margin-top: 16px; width: 50px">
<i class="fa-solid fa-user-pen" style="font-size: 50px;"></i>
</div>
<div class="right-column">
<a class="header row pt-2">Username: </a>
<a class="header row pt-2">Plan: </a>
<a class="header row pt-2">Discord: </a>
<a class="header row pt-2">Date of registration: </a>
<a class="header row pt-2">Used searches: /</a>
</div>
</div>
<div class="mt-2">
<a class="btn shadow text-white me-1" style="background-color: #7289da">Link Discord</a>
<a class="btn btn-secondary shadow text-white me-1">Change password</a>
<a class="btn btn-danger shadow text-white" data-bs-toggle="modal" data-bs-target="#logout">Log out</a>
<div class="modal fade" id="logout" data-bs-backdrop="logout" data-bs-keyboard="false" tabindex="-1" aria-hidden="true">
<div class="modal-dialog modal-dialog-centered" style=" width: 25rem">
<div class="modal-content text-white">
<div class="modal-body" style="background-color: #0e0e0e">
<div class="container">
<div class="row justify-content-center">
<div class="col-1" style="text-align: left; margin-left: 15px; margin-top: 16px; width: 50px">
<i class="fa-solid fa-triangle-exclamation" style="font-size: 50px;"></i>
</div>
<div class="col-8 mt-4">
Are you sure you wish to log out?
</div>
</div>
</div>
</div>
<div class="modal-footer border-0 justify-content-center" style="background-color: #0e0e0e">
<button type="button" class="btn btn-secondary" data-bs-dismiss="modal">Cancel</button>
<button data-bs-dismiss="modal" type="button" class="btn btn-danger" #click="deleteCookie()">Log out</button>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
<div class="col">
<h1 class="header">Plan</h1>
<div class="card card-large border-0 me-1">
<div class="card-body shadow">
<div class="row row-cols-2">
<div class="col" style="text-align: left; margin-left: 15px; margin-top: 16px; width: 50px">
<i class="fa-solid fa-tag" style="font-size: 50px;"></i>
</div>
<div class="right-column">
<a class="header row pt-2">Plan: </a>
<a class="header row pt-2">Date of Purchase: </a>
<a class="header row pt-2">Date of Expiration: </a>
</div>
</div>
<div class="mt-2">
<a class="btn btn-primary shadow text-white me-1" #click="">Upgrade</a>
<a class="btn btn-danger shadow text-white">Cancel</a>
</div>
</div>
</div>
</div>
<div class="col">
<h1 class="header">API</h1>
<div class="card card-large border-0 me-3">
<div class="card-body shadow">
<div class="row row-cols-2">
<div class="col" style="text-align: left; margin-left: 15px; margin-top: 16px; width: 50px">
<i class="fa-solid fa-code" style="font-size: 50px;"></i>
</div>
<div class="right-column">
<a class="header row pt-2">Used searches: /</a>
</div>
</div>
<div class="mt-2">
<a class="btn btn-secondary shadow text-white me-1 disabled">API docs</a>
<a class="btn btn-secondary shadow text-white me-1" onclick="">Copy API key</a>
<a class="btn btn-secondary shadow text-white">Regenerate API key</a>
</div>
</div>
</div>
</div>
</div>
Add col-lg-4 in column row like this
<div class="row">
<div class="col-lg-4">
//content
</div>
<div class="col-lg-4">
//content
</div>
<div class="col-lg-4">
//content
</div>
</div>
For more information, please visit this link : https://getbootstrap.com/docs/5.2/layout/columns/#how-they-work

Fill row content with an image keeping the size

My problem is in containing the images within a bootstrap row. When I add the image this is not contained adapting to the size of the row but for some reason it follows its size by activating the scroll.
I would like the image to fit into the container without causing scrolling when resizing the image.
This is the correct behavior when not adding any elements in the row:
<div class="container-fluid">
<div class="row justify-content-center min-vh-100 pt-3 ps-3 pb-3">
<div class="col" style="background-color: rgba(0,0,0,.03);">
<div class="d-flex flex-column h-100">
<div class="row flex-grow-1 h-50 slot border border-3 rounded" slot="1">
<div class="container-fluid d-flex " style="background-color: rgba(0,0,0,.03);">
<div class="align-self-center mx-auto">
<button type="button" class="btn btn-xs btn-icon btn-round btn-light new-stream-btn" slot="1">
<i class="fa fa-plus text-dark"></i>
</button>
</div>
</div>
</div>
<div class="row flex-grow-1 h-50 slot border border-3 rounded" slot="1">
<div class="container-fluid d-flex " style="background-color: rgba(0,0,0,.03);">
<div class="align-self-center mx-auto">
<button type="button" class="btn btn-xs btn-icon btn-round btn-light new-stream-btn" slot="1">
<i class="fa fa-plus text-dark"></i>
</button>
</div>
</div>
</div>
</div>
</div>
<div class="col" style="background-color: rgba(0,0,0,.03);">
<div class="d-flex flex-column h-100">
<div class="row flex-grow-1 h-50 slot border border-3 rounded" slot="1">
<div class="container-fluid d-flex " style="background-color: rgba(0,0,0,.03);">
<div class="align-self-center mx-auto">
<button type="button" class="btn btn-xs btn-icon btn-round btn-light new-stream-btn" slot="1">
<i class="fa fa-plus text-dark"></i>
</button>
</div>
</div>
</div>
<div class="row flex-grow-1 h-50 slot border border-3 rounded" slot="1">
<div class="container-fluid d-flex " style="background-color: rgba(0,0,0,.03);">
<div class="align-self-center mx-auto">
<button type="button" class="btn btn-xs btn-icon btn-round btn-light new-stream-btn" slot="1">
<i class="fa fa-plus text-dark"></i>
</button>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
While this is the behavior when I add an image:
<div class="container-fluid">
<div class="row justify-content-center min-vh-100 pt-3 ps-3 pb-3">
<div class="col" style="background-color: rgba(0,0,0,.03);">
<div class="d-flex flex-column h-100">
<div class="row flex-grow-1 h-50 slot border border-3 rounded " slot="1">
<img class="img-responsive w-100 h-100 px-0 rounded" src="https://www.logo.wine/a/logo/Stack_Overflow/Stack_Overflow-Logo.wine.svg">
</div>
<div class="row flex-grow-1 h-50 slot border border-3 rounded " slot="1">
<img class="img-responsive w-100 h-100 px-0 rounded" src="https://www.logo.wine/a/logo/Stack_Overflow/Stack_Overflow-Logo.wine.svg">
</div>
</div>
</div>
<div class="col" style="background-color: rgba(0,0,0,.03);">
<div class="d-flex flex-column h-100">
<div class="row flex-grow-1 h-50 slot border border-3 rounded" slot="1">
<div class="container-fluid d-flex " style="background-color: rgba(0,0,0,.03);">
<div class="align-self-center mx-auto">
<button type="button" class="btn btn-xs btn-icon btn-round btn-light new-stream-btn" slot="1">
<i class="fa fa-plus text-dark"></i>
</button>
</div>
</div>
</div>
<div class="row flex-grow-1 h-50 slot border border-3 rounded" slot="1">
<div class="container-fluid d-flex " style="background-color: rgba(0,0,0,.03);">
<div class="align-self-center mx-auto">
<button type="button" class="btn btn-xs btn-icon btn-round btn-light new-stream-btn" slot="1">
<i class="fa fa-plus text-dark"></i>
</button>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
You can use a trick sizing image to an height of 0 and a min-height of 100%
style="height:0;min-height:100%;" or via a custom class (better practice)
idea:
<link href="https://cdnjs.cloudflare.com/ajax/libs/bootstrap/5.0.2/css/bootstrap.min.css" rel="stylesheet"/>
<div class="container-fluid">
<div class="row justify-content-center min-vh-100 mh-100 pt-3 ps-3 pb-3">
<div class="col" style="background-color: rgba(0,0,0,.03);">
<div class="d-flex flex-column h-100 ">
<div class="row flex-grow-1 h-50 slot border border-3 rounded " slot="1">
<img class="img-responsive px-0 rounded" style="height:0;min-height:100%;" src="https://www.logo.wine/a/logo/Stack_Overflow/Stack_Overflow-Logo.wine.svg">
</div>
<div class="row flex-grow-1 h-50 slot border border-3 rounded " slot="1">
<img class="img-responsive px-0 rounded" style="height:0;min-height:100%;" src="https://www.logo.wine/a/logo/Stack_Overflow/Stack_Overflow-Logo.wine.svg">
</div>
</div>
</div>
<div class="col" style="background-color: rgba(0,0,0,.03);">
<div class="d-flex flex-column h-100">
<div class="row flex-grow-1 h-50 slot border border-3 rounded" slot="1">
<div class="container-fluid d-flex " style="background-color: rgba(0,0,0,.03);">
<div class="align-self-center mx-auto">
<button type="button" class="btn btn-xs btn-icon btn-round btn-light new-stream-btn" slot="1">
<i class="fa fa-plus text-dark"></i>
</button>
</div>
</div>
</div>
<div class="row flex-grow-1 h-50 slot border border-3 rounded" slot="1">
<div class="container-fluid d-flex " style="background-color: rgba(0,0,0,.03);">
<div class="align-self-center mx-auto">
<button type="button" class="btn btn-xs btn-icon btn-round btn-light new-stream-btn" slot="1">
<i class="fa fa-plus text-dark"></i>
</button>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
Another possibility is also to set a max-height on the conatiners
other possible example:
.max-vh-100{max-height:calc(100vh - 2em);}/* takes into account : pt-3 p-s3 pb-3 that could be turned into p-3 */
<link href="https://cdnjs.cloudflare.com/ajax/libs/bootstrap/5.0.2/css/bootstrap.min.css" rel="stylesheet"/>
<div class="container-fluid">
<div class="row justify-content-center min-vh-100 p-3">
<div class="col" style="background-color: rgba(0,0,0,.03);">
<div class="d-flex flex-column h-100 max-vh-100">
<div class="row flex-grow-1 h-50 slot border border-3 rounded " slot="1">
<img class="img-responsive w-100 h-100 px-0 rounded" src="https://www.logo.wine/a/logo/Stack_Overflow/Stack_Overflow-Logo.wine.svg">
</div>
<div class="row flex-grow-1 h-50 slot border border-3 rounded " slot="1">
<img class="img-responsive w-100 h-100 px-0 rounded" src="https://www.logo.wine/a/logo/Stack_Overflow/Stack_Overflow-Logo.wine.svg">
</div>
</div>
</div>
<div class="col" style="background-color: rgba(0,0,0,.03);">
<div class="d-flex flex-column h-100 max-vh-100">
<div class="row flex-grow-1 h-50 slot border border-3 rounded" slot="1">
<div class="container-fluid d-flex " style="background-color: rgba(0,0,0,.03);">
<div class="align-self-center mx-auto">
<button type="button" class="btn btn-xs btn-icon btn-round btn-light new-stream-btn" slot="1">
<i class="fa fa-plus text-dark"></i>
</button>
</div>
</div>
</div>
<div class="row flex-grow-1 h-50 slot border border-3 rounded" slot="1">
<div class="container-fluid d-flex " style="background-color: rgba(0,0,0,.03);">
<div class="align-self-center mx-auto">
<button type="button" class="btn btn-xs btn-icon btn-round btn-light new-stream-btn" slot="1">
<i class="fa fa-plus text-dark"></i>
</button>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
.max-vh-100{max-height:calc(100vh - 2em);}takes into account : pt-3 ps-3 pb-3 that could be turned into p-3

Making bootstrap5 col only go down to footer

For this project I have to display a specific email adresses mailbox. In particular I need the 'Mail Card List' to be a scrollable component instead of stretching down the page, past the footer. I have tried using the 'max-height: ;' css style but that sets a fixed height. I am after a variable height (so it will work on different screen sizes, etc).
I
Any advice on how to achieve this (or even where to look) would be great. Thank you.
JsFiddle: https://jsfiddle.net/6fr9bh4v/4/
<!doctype html>
<html lang="en">
<head>
<!-- Required meta tags -->
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<!-- Bootstrap CSS -->
<link href="https://cdn.jsdelivr.net/npm/bootstrap#5.1.0/dist/css/bootstrap.min.css" rel="stylesheet" integrity="sha384-KyZXEAg3QhqLMpG8r+8fhAXLRk2vvoC2f3B09zVXn8CA5QIVfZOJ3BCsw2P0p/We" crossorigin="anonymous">
<title>TEMP MAIL</title>
</head>
<body>
<nav class="navbar navbar-expand-lg navbar-light bg-light">
<div class="container-fluid">
<a class="navbar-brand" href="#">EMAIL</a>
<button class="navbar-toggler" type="button" data-bs-toggle="collapse" data-bs-target="#navbarSupportedContent" aria-controls="navbarSupportedContent" aria-expanded="false" aria-label="Toggle navigation">
<span class="navbar-toggler-icon"></span>
</button>
<div class="collapse navbar-collapse" id="navbarSupportedContent">
<ul class="navbar-nav me-auto mb-2 mb-lg-0">
<li class="nav-item">
<a class="nav-link active" aria-current="page" href="#">Home</a>
</li>
<li class="nav-item">
<a class="nav-link" aria-current="page" href="#">Report</a>
</li>
<li class="nav-item">
<a class="nav-link" href="#">Help</a>
</li>
</ul>
</div>
</div>
</nav>
<!-- MAILBOX PAGE -->
<div class="container">
<div class="row">
<div class="col-10">
<h1 class="d-flex justify-content-center">
<span class="badge bg-secondary m-3">user#domain.com</span>
</h1>
</div>
<div class="col-2 d-flex justify-content-center">
<button class="btn btn-outline-success mt-4 mb-4 mx-1">Return</button>
<button class="btn btn-outline-primary mt-4 mb-4 mx-1">Refresh</button>
</div>
<hr>
<!-- BASE - Search component -->
<div class="col-3">
<div class="input-group mb-3">
<input class="form-control" type="text">
<button class="btn btn-outline-success">Search</button>
<button class="btn btn-outline-danger">Clear</button>
</div>
</div>
<!-- EMAIL VIEW ONLY | ADD -->
<div class="col-7">
<div>
<dl class="row">
<dt class="col-2 text-end m-0">
From:
</dt>
<dd class="col-10 m-0">
Larry
</dd>
<dt class="col-2 text-end m-0">
To:
</dt>
<dd class="col-10 m-0">
Dan
</dd>
<dt class="col-2 text-end m-0">
Date:
</dt>
<dd class="col-10 m-0">
1/1/2000
</dd>
<dt class="col-2 text-end m-0">
Subject:
</dt>
<dd class="col-10 m-0">
Test email!
</dd>
</dl>
</div>
</div>
<div class="col-2 d-flex justify-content-center">
<div>
<button class="btn btn-outline-danger mt-2 mb-2">Delete</button>
<br>
<!--
<button class="btn btn-outline-danger mt-2 mb-2">Delete</button>
-->
</div>
</div>
<hr>
<!-- EMAIL CARD LIST -->
<div class="col-3" style="overflow-y: scroll;">
<!-- EMAIL CARD -->
<div class="row card mt-1 mb-1">
<button class="btn btn-block px-4">
<div class="row">Email Subject 1</div>
<div class="row">Test#Domain.com</div>
<div class="row">TIME</div>
</button>
</div>
<div class="row card mt-1 mb-1">
<button class="btn btn-block px-4">
<div class="row">Email Subject 2</div>
<div class="row">Test#Domain.com</div>
<div class="row">TIME</div>
</button>
</div>
<div class="row card mt-1 mb-1">
<button class="btn btn-block px-4">
<div class="row">Email Subject 3</div>
<div class="row">Test#Domain.com</div>
<div class="row">TIME</div>
</button>
</div>
<div class="row card mt-1 mb-1">
<button class="btn btn-block px-4">
<div class="row">Email Subject 4</div>
<div class="row">Test#Domain.com</div>
<div class="row">TIME</div>
</button>
</div>
<div class="row card mt-1 mb-1">
<button class="btn btn-block px-4">
<div class="row">Email Subject 4</div>
<div class="row">Test#Domain.com</div>
<div class="row">TIME</div>
</button>
</div>
<div class="row card mt-1 mb-1">
<button class="btn btn-block px-4">
<div class="row">Email Subject 4</div>
<div class="row">Test#Domain.com</div>
<div class="row">TIME</div>
</button>
</div>
<div class="row card mt-1 mb-1">
<button class="btn btn-block px-4">
<div class="row">Email Subject 4</div>
<div class="row">Test#Domain.com</div>
<div class="row">TIME</div>
</button>
</div>
<div class="row card mt-1 mb-1">
<button class="btn btn-block px-4">
<div class="row">Email Subject 4</div>
<div class="row">Test#Domain.com</div>
<div class="row">TIME</div>
</button>
</div>
<div class="row card mt-1 mb-1">
<button class="btn btn-block px-4">
<div class="row">Email Subject 4</div>
<div class="row">Test#Domain.com</div>
<div class="row">TIME</div>
</button>
</div>
<div class="row card mt-1 mb-1">
<button class="btn btn-block px-4">
<div class="row">Email Subject 4</div>
<div class="row">Test#Domain.com</div>
<div class="row">TIME</div>
</button>
</div>
<div class="row card mt-1 mb-1">
<button class="btn btn-block px-4">
<div class="row">Email Subject 4</div>
<div class="row">Test#Domain.com</div>
<div class="row">TIME</div>
</button>
</div>
</div>
<!-- EMAIL VIEW ONLY -->
<div class="col-9">SHOW EMAIL HERE</div>
</div>
</div>
<footer class="footer fixed-bottom">
<div class="container-fluid text-center p-4" style="background-color: rgba(0, 0, 0, 0.05);">
THIS IS A FOOTER
<br>
<a class="text-reset fw-bold" href="#">FOOTER LINK</a>
</div>
</footer>
<!-- Bootstrap Bundle with Popper -->
<script src="https://cdn.jsdelivr.net/npm/bootstrap#5.1.0/dist/js/bootstrap.bundle.min.js" integrity="sha384-U1DAWAznBHeqEIlVSCgzq+c9gqGAJn5c/t99JyeKa9xxaYpSvHU5awsuZVVFIhvj" crossorigin="anonymous"></script>
</body>
</html>
Replace the inline style rule for overflow, you are using bootstrap, use the overflow-scroll class.
For the overflow to work you need to give it height, but since this is to be dynamic (to work across devices), so you will need to make it relative to viewport
<!-- EMAIL LIST -->
<div class="col-3 overflow-scroll vh-100">
.
.
.
</div>
With the above changes you'll see improvements but, you will need to consider the height that the rest of the elements (navigation etc) take. And when you have this in pixels, you can use CSS calc() to subtract it from the full viewport height. Create a class for your custom height relative to the viewport, for example:
.custom-height {
height: calc(100vh - 400px);
min-height: 60px; /* add min-height to prevent it from becoming way too small if not enough vertical space*/
}
To allow space for the footer add margin on the "mailbox page" container div, mb-5
Remove fixed-bottom from <footer>
Full code:
.custom-height {
height: calc(100vh - 400px);
min-height: 60px;
}
<!doctype html>
<html lang="en">
<head>
<!-- Required meta tags -->
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<!-- Bootstrap CSS -->
<link href="https://cdn.jsdelivr.net/npm/bootstrap#5.1.0/dist/css/bootstrap.min.css" rel="stylesheet" integrity="sha384-KyZXEAg3QhqLMpG8r+8fhAXLRk2vvoC2f3B09zVXn8CA5QIVfZOJ3BCsw2P0p/We" crossorigin="anonymous">
<title>TEMP MAIL</title>
</head>
<body>
<!-- https://getbootstrap.com/docs/5.1/getting-started/introduction/ -->
<nav class="navbar navbar-expand-lg navbar-light bg-light">
<div class="container-fluid">
<a class="navbar-brand" href="#">LarryMail</a>
<button class="navbar-toggler" type="button" data-bs-toggle="collapse" data-bs-target="#navbarSupportedContent" aria-controls="navbarSupportedContent" aria-expanded="false" aria-label="Toggle navigation">
<span class="navbar-toggler-icon"></span>
</button>
<div class="collapse navbar-collapse" id="navbarSupportedContent">
<ul class="navbar-nav me-auto mb-2 mb-lg-0">
<li class="nav-item">
<a class="nav-link active" aria-current="page" href="#">Home</a>
</li>
<li class="nav-item">
<a class="nav-link" aria-current="page" href="#">Report</a>
</li>
<!-- API ACCESS | ON BACK LIST
<li class="nav-item">
<a class="nav-link" aria-current="page" href="#">API</a>
</li>
-->
<li class="nav-item">
<a class="nav-link" href="#">Help</a>
</li>
</ul>
<form class="d-flex">
<input class="form-control me-2" type="search" placeholder="Search" aria-label="Search">
<select class="form-select me-2" aria-label="Default select example">
<option selected>Select Domain</option>
<option value="1">#crazyforher.com</option>
<option value="2">#etc...</option>
<option value="3">#etc...</option>
</select>
<button class="btn btn-outline-success me-2" type="submit">Search</button>
</form>
</div>
</div>
</nav>
<!--
{% block content %}
{% endblock %}
-->
<!-- HOME PAGE
<main class="flex-shrink-0">
<div class="container">
<h1 class="mt-5">LarryMail</h1>
<p class="lead">Unlimited mailboxes. Courtesy of Larry.</p>
<form class="d-flex">
<input class="form-control me-2" type="search" placeholder="Search" aria-label="Search">
<select class="form-select me-2" aria-label="Default select example">
<option selected>Select Domain</option>
<option value="1">#crazyforher.com</option>
<option value="2">#etc...</option>
<option value="3">#etc...</option>
</select>
<button class="btn btn-outline-success me-2" type="submit">Search</button>
</form>
</div>
</main>
-->
<!-- MAILBOX PAGE -->
<div class="container mb-5">
<div class="row">
<div class="col-10">
<h1 class="d-flex justify-content-center">
<span class="badge bg-secondary m-3">admin#crazyforher.com</span>
</h1>
</div>
<div class="col-2 d-flex justify-content-center">
<button class="btn btn-outline-success mt-4 mb-4 mx-1">Return</button>
<button class="btn btn-outline-primary mt-4 mb-4 mx-1">Refresh</button>
</div>
<hr>
<!-- BASE - Search component -->
<div class="col-3">
<div class="input-group mb-3">
<input class="form-control" type="text">
<button class="btn btn-outline-success">Search</button>
<button class="btn btn-outline-danger">Clear</button>
</div>
</div>
<!-- EMAIL VIEW ONLY | ADD -->
<div class="col-7">
<!-- IF MAILBOX EMPTY
<p>
Select a message at left, or enter a different username into the box on upper right.
</p>
-->
<div>
<dl class="row">
<dt class="col-2 text-end m-0">
From:
</dt>
<dd class="col-10 m-0">
Larry
</dd>
<dt class="col-2 text-end m-0">
To:
</dt>
<dd class="col-10 m-0">
Larry
</dd>
<dt class="col-2 text-end m-0">
Date:
</dt>
<dd class="col-10 m-0">
Larry
</dd>
<dt class="col-2 text-end m-0">
Subject:
</dt>
<dd class="col-10 m-0">
Larry
</dd>
</dl>
</div>
</div>
<div class="col-2 d-flex justify-content-center">
<div>
<button class="btn btn-outline-danger mt-2 mb-2">Delete</button>
<br>
<!--
<button class="btn btn-outline-danger mt-2 mb-2">Delete</button>
-->
</div>
</div>
<hr>
<!-- EMAIL LIST -->
<div class="col-3 overflow-scroll custom-height">
<!-- EMAIL CARD -->
<div class="row card mt-1 mb-1">
<button class="btn btn-block px-4">
<div class="row">Email Subject 1</div>
<div class="row">Test#Domain.com</div>
<div class="row">TIME</div>
</button>
</div>
<div class="row card mt-1 mb-1">
<button class="btn btn-block px-4">
<div class="row">Email Subject 2</div>
<div class="row">Test#Domain.com</div>
<div class="row">TIME</div>
</button>
</div>
<div class="row card mt-1 mb-1">
<button class="btn btn-block px-4">
<div class="row">Email Subject 3</div>
<div class="row">Test#Domain.com</div>
<div class="row">TIME</div>
</button>
</div>
<div class="row card mt-1 mb-1">
<button class="btn btn-block px-4">
<div class="row">Email Subject 4</div>
<div class="row">Test#Domain.com</div>
<div class="row">TIME</div>
</button>
</div>
<div class="row card mt-1 mb-1">
<button class="btn btn-block px-4">
<div class="row">Email Subject 4</div>
<div class="row">Test#Domain.com</div>
<div class="row">TIME</div>
</button>
</div>
<div class="row card mt-1 mb-1">
<button class="btn btn-block px-4">
<div class="row">Email Subject 4</div>
<div class="row">Test#Domain.com</div>
<div class="row">TIME</div>
</button>
</div>
<div class="row card mt-1 mb-1">
<button class="btn btn-block px-4">
<div class="row">Email Subject 4</div>
<div class="row">Test#Domain.com</div>
<div class="row">TIME</div>
</button>
</div>
<div class="row card mt-1 mb-1">
<button class="btn btn-block px-4">
<div class="row">Email Subject 4</div>
<div class="row">Test#Domain.com</div>
<div class="row">TIME</div>
</button>
</div>
<div class="row card mt-1 mb-1">
<button class="btn btn-block px-4">
<div class="row">Email Subject 4</div>
<div class="row">Test#Domain.com</div>
<div class="row">TIME</div>
</button>
</div>
<div class="row card mt-1 mb-1">
<button class="btn btn-block px-4">
<div class="row">Email Subject 4</div>
<div class="row">Test#Domain.com</div>
<div class="row">TIME</div>
</button>
</div>
<div class="row card mt-1 mb-1">
<button class="btn btn-block px-4">
<div class="row">Email Subject 4</div>
<div class="row">Test#Domain.com</div>
<div class="row">TIME</div>
</button>
</div>
</div>
<!-- EMAIL VIEW ONLY -->
<div class="col-9">SHOW EMAIL HERE</div>
</div>
</div>
<footer class="footer">
<div class="container-fluid text-center p-4" style="background-color: rgba(0, 0, 0, 0.05);">
THIS IS A FOOTER
<br>
<a class="text-reset fw-bold" href="#">FOOTER LINK</a>
</div>
</footer>
<!-- Bootstrap Bundle with Popper -->
<script src="https://cdn.jsdelivr.net/npm/bootstrap#5.1.0/dist/js/bootstrap.bundle.min.js" integrity="sha384-U1DAWAznBHeqEIlVSCgzq+c9gqGAJn5c/t99JyeKa9xxaYpSvHU5awsuZVVFIhvj" crossorigin="anonymous"></script>
</body>
</html>

(Bootstrap 4) : Align Button with the text to be same line

How to align all divs to be center on the same line. What I mean I want the button to be centered with text like such image, for example, the social icons are centered like text not down like mine in dark
<link href="https://stackpath.bootstrapcdn.com/bootstrap/4.4.1/css/bootstrap.min.css" rel="stylesheet"/>
<footer id="main-footer" class="bg-dark">
<div class="container d-flex flex-sm-column justify-content-between py-3">
<div class="row py-4 text-center align-content-between flex-wrap">
<div class="col-lg-4 mb-3">
<p class="text-secondary">Copyright © Saud</p>
</div>
<div class="col-lg-4 mb-3 ">
<!-- Button trigger modal -->
<button type="button" class="btn btn-primary " data-toggle="modal" data-target="#exampleModal">
Contact Us
</button>
</div>
<div class="col-lg-4 mb-3">
<ul class="list-inline quicklinks">
<li class="list-inline-item">
Privacy Policy
</li>
<li class="list-inline-item">
Terms of Use
</li>
</ul>
</div>
</div>
</div>
</footer>
To center align them, make the columns d-flex and use align-items-center...
<div class="row text-center py-4 align-content-between flex-wrap">
<div class="col-lg-4 d-flex justify-content-center align-items-center">
<p class="text-secondary mb-0">Copyright © Saud</p>
</div>
<div class="col-lg-4">
<!-- Button trigger modal -->
<button type="button" class="btn btn-primary " data-toggle="modal" data-target="#exampleModal"> Contact Us </button>
</div>
<div class="col-lg-4 d-flex justify-content-center align-items-center">
<ul class="list-inline quicklinks mb-0">
<li class="list-inline-item">
Privacy Policy
</li>
<li class="list-inline-item">
Terms of Use
</li>
</ul>
</div>
</div>
https://codeply.com/p/BBJM8P9UPR
You want to align all the elements by its' texts, right? If so, in the div.row add align-items-baseline class.
See Bootstrap and MDN documentation for details.
<link href="https://stackpath.bootstrapcdn.com/bootstrap/4.4.1/css/bootstrap.min.css" rel="stylesheet"/>
<footer id="main-footer" class="bg-dark">
<div class="container d-flex flex-sm-column justify-content-between py-3">
<div class="row py-4 text-center align-content-between flex-wrap align-items-baseline">
<div class="col-lg-4 mb-3">
<p class="text-secondary">Copyright © Saud</p>
</div>
<div class="col-lg-4 mb-3 ">
<!-- Button trigger modal -->
<button type="button" class="btn btn-primary " data-toggle="modal" data-target="#exampleModal">
Contact Us
</button>
</div>
<div class="col-lg-4 mb-3">
<ul class="list-inline quicklinks">
<li class="list-inline-item">
Privacy Policy
</li>
<li class="list-inline-item">
Terms of Use
</li>
</ul>
</div>
</div>
</div>
</footer>

How do I fix this overflow problem without setting any height? [closed]

Closed. This question needs details or clarity. It is not currently accepting answers.
Want to improve this question? Add details and clarify the problem by editing this post.
Closed 3 years ago.
Improve this question
I have been working on this interface for few days using bootstrap4 and I cant get this one div to get a scrollbar without setting height in px's. Also a guide toward managing one page design?
Following is the link to the HTML code.
https://www.codeply.com/p/xm4bUOWFVh
To make an element within a flexbox state scrollable you can make a new container within the flexbox element and set to position: absolute;
Hopefully this helps. See my example below.
#chat-list {
position: relative;
overflow-y: scroll;
height: 100%;
}
.chat-scroll {
position: absolute;
top: 0;
left: 0;
}
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Document</title>
<link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/4.3.1/css/bootstrap.min.css" integrity="sha384-ggOyR0iXCbMQv3Xipma34MD+dH/1fQ784/j6cY/iJTQUOhcWr7x9JvoRxT2MZw1T" crossorigin="anonymous">
</head>
<body>
<div class="container border bg-success w-100" style="height: 95vh;">
<div class="row h-100">
<div class="col-md-12">
<h3>My Whatsapp</h3>
</div>
<div class="col-12 col-sm-5 col-md-4 d-flex flex-column border " id="chat-list-area" style="position:relative; ">
<!-- Navbar -->
<div class="row d-flex flex-row align-items-center p-2 bg-warning " id="navbar">
<div class="text-white font-weight-bold">My Chats</div>
<div class="nav-item dropdown ml-auto">
<a class="nav-link dropdown-toggle" data-toggle="dropdown" href="#" role="button" aria-haspopup="true" aria-expanded="false"><i class="fas fa-ellipsis-v text-white"></i></a>
<div class="dropdown-menu dropdown-menu-right">
<a class="dropdown-item" href="#">New Group</a>
<a class="dropdown-item" href="#">Archived</a>
<a class="dropdown-item" href="#">Starred</a>
<a class="dropdown-item" href="#">Settings</a>
<a class="dropdown-item" href="#">Log Out</a>
</div>
</div>
</div>
<!-- Chat List -->
<div class="row" id="chat-list">
<!-- new container -->
<div class="chat-scroll">
<!-- new container -->
<div class="col-xs-12 w-100 bg-light">
<div class="chat-list-item d-flex flex-row w-100 p-2 border-bottom active" style="">
<div class="w-50">
<div class="name">Programmers</div>
<div class="small last-message">+91 98232 37261: yeah, i'm online</div>
</div>
<div class="flex-grow-1 text-right">
<div class="small time">28/03/2018</div>
<div class="badge badge-success badge-pill small d-none" id="unread-count">2</div>
</div>
</div>
<div class="chat-list-item d-flex flex-row w-100 p-2 border-bottom">
<div class="w-50">
<div class="name">Dee</div>
<div class="small last-message"><i class="fas fa-check-circle mr-1"></i> if you go to the movie, then give me a call</div>
</div>
<div class="flex-grow-1 text-right">
<div class="small time">27/03/2018</div>
</div>
</div>
<div class="chat-list-item d-flex flex-row w-100 p-2 border-bottom unread" onclick="">
<div class="w-50">
<div class="name">Jimmy</div>
<div class="small last-message"> have you seen infinity war?</div>
</div>
<div class="flex-grow-1 text-right">
<div class="small time">27/03/2018</div>
<div class="badge badge-success badge-pill small" id="unread-count">1</div>
</div>
</div>
<div class="chat-list-item d-flex flex-row w-100 p-2 border-bottom" onclick="">
<div class="w-50">
<div class="name">John</div>
<div class="small last-message"><i class="far fa-check-circle mr-1"></i> yup</div>
</div>
<div class="flex-grow-1 text-right">
<div class="small time">27/03/2018</div>
</div>
</div>
<div class="chat-list-item d-flex flex-row w-100 p-2 border-bottom" onclick=" ">
<div class="w-50">
<div class="name">Rob Mobile</div>
<div class="small last-message"><i class="far fa-check-circle mr-1"></i> i'm good too</div>
</div>
<div class="flex-grow-1 text-right">
<div class="small time">26/03/2018</div>
</div>
</div>
<div class="chat-list-item d-flex flex-row w-100 p-2 border-bottom" onclick=" ">
<div class="w-50">
<div class="name">Rob Mobile</div>
<div class="small last-message"><i class="far fa-check-circle mr-1"></i> i'm good too</div>
</div>
<div class="flex-grow-1 text-right">
<div class="small time">26/03/2018</div>
</div>
</div>
<div class="chat-list-item d-flex flex-row w-100 p-2 border-bottom" onclick=" ">
<div class="w-50">
<div class="name">Rob Mobile</div>
<div class="small last-message"><i class="far fa-check-circle mr-1"></i> i'm good too</div>
</div>
<div class="flex-grow-1 text-right">
<div class="small time">26/03/2018</div>
</div>
</div>
<div class="chat-list-item d-flex flex-row w-100 p-2 border-bottom" onclick=" ">
<div class="w-50">
<div class="name">Rob Mobile</div>
<div class="small last-message"><i class="far fa-check-circle mr-1"></i> i'm good too</div>
</div>
<div class="flex-grow-1 text-right">
<div class="small time">26/03/2018</div>
</div>
</div>
<div class="chat-list-item d-flex flex-row w-100 p-2 border-bottom" onclick=" ">
<div class="w-50">
<div class="name">Rob Mobile</div>
<div class="small last-message"><i class="far fa-check-circle mr-1"></i> i'm good too</div>
</div>
<div class="flex-grow-1 text-right">
<div class="small time">26/03/2018</div>
</div>
</div>
<div class="chat-list-item d-flex flex-row w-100 p-2 border-bottom" onclick=" ">
<div class="w-50">
<div class="name">Rob Mobile</div>
<div class="small last-message"><i class="far fa-check-circle mr-1"></i> i'm good too</div>
</div>
<div class="flex-grow-1 text-right">
<div class="small time">26/03/2018</div>
</div>
</div>
<div class="chat-list-item d-flex flex-row w-100 p-2 border-bottom" onclick=" ">
<div class="w-50">
<div class="name">Rob Mobile</div>
<div class="small last-message"><i class="far fa-check-circle mr-1"></i> i'm good too</div>
</div>
<div class="flex-grow-1 text-right">
<div class="small time">26/03/2018</div>
</div>
</div>
<div class="chat-list-item d-flex flex-row w-100 p-2 border-bottom" onclick=" ">
<div class="w-50">
<div class="name">Rob Mobile</div>
<div class="small last-message"><i class="far fa-check-circle mr-1"></i> i'm good too</div>
</div>
<div class="flex-grow-1 text-right">
<div class="small time">26/03/2018</div>
</div>
</div>
<div class="chat-list-item d-flex flex-row w-100 p-2 border-bottom" onclick=" ">
<div class="w-50">
<div class="name">Rob Mobile</div>
<div class="small last-message"><i class="far fa-check-circle mr-1"></i> i'm good too</div>
</div>
<div class="flex-grow-1 text-right">
<div class="small time">26/03/2018</div>
</div>
</div>
<div class="chat-list-item d-flex flex-row w-100 p-2 border-bottom" onclick=" ">
<div class="w-50">
<div class="name">Rob Mobile</div>
<div class="small last-message"><i class="far fa-check-circle mr-1"></i> i'm good too</div>
</div>
<div class="flex-grow-1 text-right">
<div class="small time">26/03/2018</div>
</div>
</div>
<div class="chat-list-item d-flex flex-row w-100 p-2 border-bottom" onclick=" ">
<div class="w-50">
<div class="name">Rob Mobile</div>
<div class="small last-message"><i class="far fa-check-circle mr-1"></i> i'm good too</div>
</div>
<div class="flex-grow-1 text-right">
<div class="small time">26/03/2018</div>
</div>
</div>
<div class="chat-list-item d-flex flex-row w-100 p-2 border-bottom" onclick=" ">
<div class="w-50">
<div class="name">Rob Mobile</div>
<div class="small last-message"><i class="far fa-check-circle mr-1"></i> i'm good too</div>
</div>
<div class="flex-grow-1 text-right">
<div class="small time">26/03/2018</div>
</div>
</div>
</div>
</div>
</div>
<!-- Profile Settings -->
</div>
<!-- Message Area -->
<div class="d-none d-sm-flex flex-column col-12 col-sm-7 col-md-8 p-0 " style="height: 95%;" id="message-area">
<!-- Navbar -->
<div class="row d-flex flex-row align-items-center p-2 m-0 w-100 border bg-primary" id="navbar">
<div class="d-block d-sm-none">
<i class="fas fa-arrow-left p-2 mr-2 text-white" style="font-size: 1.5rem; cursor: pointer;"></i>
</div>
<div class="d-flex flex-column">
<div class="text-white font-weight-bold" id="name">Programmers</div>
<div class="text-white small" id="details">You, Jimmy, Rob Mobile</div>
</div>
<div class="d-flex flex-row align-items-center ml-auto">
<i class="fas fa-search mx-3 text-white d-none d-md-block"></i>
<i class="fas fa-paperclip mx-3 text-white d-none d-md-block"></i>
<i class="fas fa-ellipsis-v mr-2 mx-sm-3 text-white"></i>
</div>
</div>
<!-- Messages -->
<div class="d-flex flex-column" id="messages" style="flex: 1!important;background: hsl(0, 0%, 80%);overflow: auto;">
<div class="mx-auto my-2 bg-primary text-white small py-1 px-2 rounded">
27/03/2018
</div>
<div class="align-self-start p-1 my-1 mx-3 rounded bg-white shadow-sm message-item">
<div class="options">
<i class="fas fa-angle-down text-muted px-2"></i>
</div>
<div class="small font-weight-bold text-primary">
+91 98232 63547
</div>
<div class="d-flex flex-row">
<div class="body m-1 mr-2">anyone online?</div>
<div class="time ml-auto small text-right flex-shrink-0 align-self-end text-muted" style="width:75px;">
18:20
</div>
</div>
</div>
<div class="mx-auto my-2 bg-primary text-white small py-1 px-2 rounded">
28/03/2018
</div>
<div class="align-self-start p-1 my-1 mx-3 rounded bg-white shadow-sm message-item">
<div class="options">
<i class="fas fa-angle-down text-muted px-2"></i>
</div>
<div class="small font-weight-bold text-primary">
+91 98232 37261
</div>
<div class="d-flex flex-row">
<div class="body m-1 mr-2">yeah, i'm online</div>
<div class="time ml-auto small text-right flex-shrink-0 align-self-end text-muted" style="width:75px;">
17:10
</div>
</div>
</div>
</div>
<!-- Input -->
<div class="justify-self-end align-items-center flex-row d-flex" id="input-area">
<i class="far fa-smile text-muted px-3" style="font-size:1.5rem;"></i>
<input type="text" name="message" id="input" placeholder="Type a message" class="flex-grow-1 border-0 px-3 py-2 my-3 rounded shadow-sm">
<i class="fas fa-paper-plane text-muted px-3" style="cursor:pointer;" onclick="sendMessage()"></i>
</div>
</div>
</div>
</div>
<script src="https://code.jquery.com/jquery-3.3.1.slim.min.js" integrity="sha384-q8i/X+965DzO0rT7abK41JStQIAqVgRVzpbzo5smXKp4YfRvH+8abtTE1Pi6jizo" crossorigin="anonymous"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/popper.js/1.14.7/umd/popper.min.js" integrity="sha384-UO2eT0CpHqdSJQ6hJty5KVphtPhzWj9WO1clHTMGa3JDZwrnQq4sF86dIHNDz0W1" crossorigin="anonymous"></script>
<script src="https://stackpath.bootstrapcdn.com/bootstrap/4.3.1/js/bootstrap.min.js" integrity="sha384-JjSmVgyd0p3pXB1rRibZUAYoIIy6OrQ6VrjIEaFf/nJGzIxFDsf4x0xIM+B07jRM" crossorigin="anonymous"></script>
</body>
</html>