Align mat-card content(filling blank space issue) - html

I'm working with mat-card in a list and i have a problem with the aligment
Here what i have:
Here what i want:
The problem is that when the size of content inside a mat card increases,next mat card should automatically adjust the space without leaving a blank space corresponding to previous larger space mat-card
I am attaching the corresponding css and html Code:
.works {
padding-left: 47px;
padding-top: 99px;
// display: inline-flex;
}
.work-head {
// width: 330px;
// height: 28px;
font-family: Raleway-SemiBold;
font-style: normal;
font-weight: 500;
font-size: 24px;
line-height: 28px;
// text-align: center;
color: #000000;
}
.work-list {
// width: 123px;
// height: 28px;
padding-left: 0px;
text-align: right;
padding-top: 23px;
font-family: Raleway-Medium;
font-style: normal;
font-weight: normal;
font-size: 24px;
line-height: 28px;
// text-align: center;
color: #000000;
}
.work-list1 {
// width: 123px;
// height: 28px;
text-align: right;
padding-top: 23px;
font-family: Raleway-Medium;
font-style: normal;
font-weight: normal;
font-size: 24px;
line-height: 28px;
// text-align: center;
padding-left: 49px;
color: #000000;
}
.work-detail {
// width: 159px;
// height: 28px;
padding-left: 0px;
text-align: left;
padding-top: 23px;
font-family: Raleway;
font-style: normal;
font-weight: 300;
font-size: 24px;
line-height: 28px;
// text-align: center;
color: #000000;
}
.flexfix {
flex-basis: 0;
}
.work-card {
// margin-right: 26px;
margin-bottom: 26px;
padding-top: 39px;
padding-left: 17px;
padding-bottom: 49px;
padding-right: 10px;
width: 506px;
// height: 244px;
background: #FFFFFF;
border: 1px solid #E5E5E5;
box-sizing: border-box;
box-shadow: 4px 4px 4px rgba(0, 0, 0, 0.04);
}
.card-margin{
margin-left: 3%;
}
<div class="works">
<div fxLayout="row layout-wrap">
<div *ngFor="let item of listOfProjects" class="card-margin">
<mat-card class="work-card">
<mat-card-title class="work-head">{{item.name}}</mat-card-title>
<img class="line-align" src="assets/icons/DashBoard/work-card-line.svg" />
<mat-card-content>
<div *ngIf="item.name==='test10'">
<div fxLayout="row" fxLayoutGap="20px">
<div class="work-list">Contractor:</div>
<div class="work-detail">{{item.baseEntityByContractor.entityName}}</div>
</div>
<div fxLayout="row" fxLayoutGap="20px">
<div class="work-list">Contractor:</div>
<div class="work-detail">{{item.baseEntityByContractor.entityName}}</div>
</div>
</div>
<div fxLayout="row" fxLayoutGap="20px">
<div class="work-list">Contractor:</div>
<div class="work-detail">{{item.baseEntityByContractor.entityName}}</div>
</div>
<div fxLayout="row" fxLayoutGap="20px">
<div class="work-list1">Status:</div>
<div class="work-detail">{{item.projectStatus.name}}</div>
</div>
</mat-card-content>
</mat-card>
</div>
</div>
</div>

Hope from the below example u will find a solution for ur problem.
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0/css/bootstrap.min.css" integrity="sha384-Gn5384xqQ1aoWXA+058RXPxPg6fy4IWvTNh0E263XmFcJlSAwiGgFAW/dAiS6JXm" crossorigin="anonymous">
<div class="row">
<div class="col-6">
<div class="row">
<div class="col-12">
<div class="card border p-3 mb-2">
<p>Lorericies nisl eget tincidunt. Vestibulum id pulvinar risus. Nam viverra pretium luctus. Morbi turpis tortor pretium luctus. Morbi turpis torto pretium luctus. Morbi turpis torto</p>
</div>
</div>
<div class="col-12">
<div class="card border p-3 mb-2">
<p>Lorem ipsum dolor sit amet, consectetur adipiscing elit. Mauris tempor ultricies nisl eget tincidunt. Vestibulutor</p>
</div>
</div>
<div class="col-12">
<div class="card border p-3 mb-2">
<p>Lorem ipsum dolor sit amet, consectetur adipiscing elit. Mauris tempor ultricies nisl eget tincidunt. Vr risus. Nam viverra pretium luctus. Morbi turpis tortor</p>
</div>
</div>
<div class="col-12">
<div class="card border p-3 mb-2">
<p>Lorem ipsum dolor sit amet, consectetur adipiscing elit. Mauris tempor ultricies nisl eget tincidunt. Vestibulum id pulvinar risus. Nam viverra pretium luctus. Morbi turpis tortor</p>
</div>
</div>
</div>
</div>
<div class="col-6">
<div class="row">
<div class="col-12">
<div class="card border p-3 mb-2">
<p>Lorem ipsum dolor sit amet, consectetur adipiscing elit. Mauris tempoar risus. Nam viverra pretium luctus. Morbi turpis tortor</p>
</div>
</div>
<div class="col-12">
<div class="card border p-3 mb-2">
<p>Lorem ipsum dolor sit amet, consectetur adipiscing elit. Mauris tempor ultricies nisl eget tincidunt. Vestibulum id pulvinar risus. Nam viverra pretium luctus. Morbi turpis tortor</p>
</div>
</div>
<div class="col-12">
<div class="card border p-3 mb-2">
<p>Lorem ipsum dolor sit amet, consectetur adipiscing elit. Mauris tempor</p>
</div>
</div>
</div>
</div>
</div>
<script src="https://code.jquery.com/jquery-3.2.1.slim.min.js" integrity="sha384-KJ3o2DKtIkvYIK3UENzmM7KCkRr/rE9/Qpg6aAZGJwFDMVNA/GpGFF93hXpG5KkN" crossorigin="anonymous"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/popper.js/1.12.9/umd/popper.min.js" integrity="sha384-ApNbgh9B+Y1QKtv3Rn7W3mgPxhU9K/ScQsAP7hUibX39j7fakFPskvXusvfa0b4Q" crossorigin="anonymous"></script>
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0/js/bootstrap.min.js" integrity="sha384-JZR6Spejh4U02d8jOt6vLEHfe/JQGiRRSQQxSfFWpi1MquVdAyjUar5+76PVCmYl" crossorigin="anonymous"></script>

This is a common css issue, and you need a masonry layout. You can achieve this, with css column-count rule, and whit inline-block elements. You need to add a media query to change the column-count responsively.
See this article, or this example.
With this, you don't need external CSS or JS library.

Related

How to align items with different heights?

I'm not sure how better to describe it, so:
I have a grid for 12 columns. (2 identical icons and 2 texts with different heights) per 6 columns. Is there any way to align icons by center and texts by the same height? I'm able to align icons but texts are always on different heights.
.benefits .benefits_item {
display: flex;
justify-content: center;
align-items: center;
margin-top: 35px;
min-height: 150px;
}
.benefits .benefits_item .benefits_round {
display: flex;
justify-content: center;
align-items: center;
margin-right: 25px;
width: 116px;
height: 116px;
background: #1EACC7;
border-radius: 50%;
}
.benefits .benefits_item .benefits_descr {
width: 370px;
font-family: 'Roboto';
font-style: normal;
font-weight: 300;
font-size: 15px;
color: #202020;
}
.benefits .benefits_item .benefits_descr span {
font-family: 'Roboto';
font-style: normal;
font-weight: 400;
font-size: 17px;
line-height: 25px;
color: #1EACC7;
<div class="row">
<div class="col-md-6">
<div class="benefits_item">
<div class="benefits_round"><img src="" alt="1" class="benefits_icon"></div>
<div class="benefits_descr"><span>Lorem ipsum dolor sit ame</span><br>Lorem ipsum dolor sit amet, consectetur adipiscing elit. Donec arcu ligula, lacinia vel fermentum elementum</div>
</div>
</div>
<div class="col-md-6">
<div class="benefits_item">
<div class="benefits_round"><img src="" alt="2" class="benefits_icon"></div>
<div class="benefits_descr"><span>Lorem ipsum</span><br>Lorem ipsum dolor sit amet, consectetur adipiscing elit. Donec arcu ligula, lacinia vel fermentum elementum, malesuada vel ante. Donec ut odio augue. Integer a aliquet quam. Aenean ut enim ullamcorper, feugiat neque ac,
pretium augue.</div>
</div>
</div>
</div>
You can add align-items-center to <div class="row"> -- Bootstrap's rows use display: flex so you can use other flex utility classes on the row
:root {
--color: #1EACC7;
--iconSize: 6rem;
}
.benefits_round {
height: var( --iconSize );
max-width: var( --iconSize ); min-width: var( --iconSize );
background-color: var( --color );
}
.benefits_descr span { color: var( --color ) }
<link href="https://cdn.jsdelivr.net/npm/bootstrap#5.1.3/dist/css/bootstrap.min.css" rel="stylesheet" integrity="sha384-1BmE4kWBq78iYhFldvKuhfTAU6auU8tT94WrHftjDbrCEXSU1oBoqyl2QvZ6jIW3" crossorigin="anonymous">
<div class="container-md">
<div class="row align-items-center">
<div class="col-sm-6">
<div class="d-flex justify-content-center align-items-center">
<div class="benefits_round rounded-circle me-4 d-flex justify-content-center align-items-center">
<img src="" alt="1">
</div>
<div class="benefits_descr fw-light">
<span class="fs-5">Lorem ipsum dolor sit ame</span>
<br>
Lorem ipsum dolor sit amet, consectetur adipiscing elit. Donec arcu ligula, lacinia vel fermentum elementum
</div>
</div>
</div>
<div class="col-sm-6">
<div class="d-flex justify-content-center align-items-center">
<div class="benefits_round rounded-circle me-4 d-flex justify-content-center align-items-center">
<img src="" alt="2">
</div>
<div class="benefits_descr fw-light">
<span class="fs-5">Lorem ipsum</span>
<br>
Lorem ipsum dolor sit amet, consectetur adipiscing elit. Donec arcu ligula, lacinia vel fermentum elementum, malesuada vel ante. Donec ut odio augue. Integer a aliquet quam. Aenean ut enim ullamcorper, feugiat neque ac, pretium augue.
</div>
</div>
</div>
</div>
</div>

Make Boxes same Height

I use Boostrap 5 and have these 4 Boxes, they are not cards. How can I get them at the same height? Content is dynamic.
You find the Codepen here:
https://codepen.io/Deluxe23/pen/gOXJWwG
Below is the HTML Code with just 2 Boxes. I can't post all because that's too much code for this Post. you'll see all 4 Boxes in the Codepen.
.box>.icon {
text-align: center;
position: relative;
}
.box>.icon>.image {
position: relative;
z-index: 2;
margin: auto;
width: 88px;
height: 88px;
border: 8px solid white;
line-height: 88px;
border-radius: 50%;
background: blue;
vertical-align: middle;
}
.box>.icon:hover>.image {
background: #333;
}
.box>.icon>.image>i {
font-size: 36px !important;
color: #fff !important;
}
.box>.icon:hover>.image>i {
color: white !important;
}
.box>.icon>.info {
margin-top: -24px;
background: rgba(0, 0, 0, 0.04);
border: 1px solid #e0e0e0;
padding: 40px 0 10px 0;
}
.box>.icon:hover>.info {
background: rgba(0, 0, 0, 0.04);
border-color: #e0e0e0;
color: white;
}
.box>.icon>.info>h3.title {
font-family: "Montserrat", sans-serif !important;
font-size: 1.25rem;
color: #222;
font-weight: 500;
}
.box>.icon>.info>p {
font-family: "Montserrat", sans-serif !important;
font-size: 16px;
color: #666;
line-height: 1.5em;
margin: 20px;
}
.box>.icon:hover>.info>h3.title,
.box>.icon:hover>.info>p,
.box>.icon:hover>.info>.more>a {
color: #222;
}
.box>.icon>.info>.more a {
font-family: "Montserrat", sans-serif !important;
font-size: 12px;
color: #222;
line-height: 12px;
text-transform: uppercase;
text-decoration: none;
}
.box>.icon:hover>.info>.more>a {
color: #fff;
padding: 6px 8px;
background-color: blue;
}
.box .space {
height: 30px;
}
<section style="background-color:#f7f7f7">
<div class="container">
<div class="row pt-mb-5 pt-lg-5 pb-mb-5 pb-lg-5">
<div class="col-6 col-sm-6 col-lg-3">
<div class="box ">
<div class="icon ">
<div class="image" style="padding-top:14px;line-height:0px;padding-left:2px"><img src="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAGQAAABkAQAAAABYmaj5AAAAAnRSTlMAAHaTzTgAAAATSURBVBgZYxgFo2AUjIJRQFcAAAV4AAHcRQIbAAAAAElFTkSuQmCC" style="max-width:45px;max-height:45px" data-src="https://iili.io/EcctII.webp" decoding="async"
class="lazyload"><noscript><img src="https://iili.io/EcctII.webp" style="max-width:45px;max-height:45px" data-eio="l"></noscript></div>
<div class="info">
<h3 class="title">BoxHeadline 1</h3>
<p>Lorem ipsum dolor sit amet, consectetur adipiscing elit. Sed in lobortis nisl, vitae iaculis sapien. Phasellus ultrices gravida massa luctus ornare. Suspendisse blandit quam elit, eu imperdiet neque semper. massa luctus ornare. Suspendisse
blandit quam elit, eu imperdiet neque semper</p>
<div class="more">
<a href="/kontakt/" title="Title Link">
Mehr Informationen<i class="fa fa-angle-double-right"></i>
</a>
</div>
</div>
</div>
<div class="space"></div>
</div>
</div>
<div class="col-6 col-sm-6 col-lg-3">
<div class="box ">
<div class="icon ">
<div class="image" style="padding-top:14px;line-height:0px;padding-left:2px"><img src="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAEsAAABLAQAAAAAQNUdHAAAAAnRSTlMAAHaTzTgAAAAQSURBVCjPY2AYBaNgFJAMAAM5AAELGjlgAAAAAElFTkSuQmCC" style="max-width:45px;max-height:45px" data-src="https://iili.io/EcctII.webp" decoding="async"
class="lazyload"><noscript><img src="https://iili.io/EcctII.webp" style="max-width:45px;max-height:45px" data-eio="l"></noscript></div>
<div class="info">
<h3 class="title">BoxHeadline 2</h3>
<p>Lorem ipsum dolor sit amet, consectetur adipiscing elit. Sed in lobortis nisl, vitae iaculis sapien. Phasellus ultrices gravida massa luctus ornare. Suspendisse blandit quam elit, eu imperdiet neque semper. </p>
</div>
</div>
<div class="space"></div>
</div>
</div>
</div>
</div>
</section>
I changed your markup around a bit and changed the only CSS needed to still maintain the design but get the heights to work, so if there is a style I missed like a font decoration you'll have to re-add that. Basically what I did is put the background and border color on box instead of info because the box is the containing div of all children (including info), so it makes sense for that one to have those styles.
Second, because when you resize horizontally your columns do not have a min-width with a breaking point set for them to go to a new line, you should set your min-height for all box's at the largest rendered height. In your case, it is box #3 with the long p text.
See the text taking the full height at the lower browser width, because all other boxes have that same min-height they will always match.
See it working here:
.icon {
text-align: center;
position: relative;
background: rgba(0, 0, 0, 0.04);
border: 1px solid #e0e0e0;
margin-top: -24px;
padding: 40px 0 0 0;
min-height: 100%;
}
.col-6>.image {
position: relative;
z-index: 2;
margin: auto;
width: 88px;
height: 88px;
border: 8px solid white;
line-height: 88px;
border-radius: 50%;
background: blue;
vertical-align: middle;
}
.col-6:hover>.image {
background: #333;
}
.info {
min-height: inherit;
}
.box {
height: 100%;
}
section {
height: 100vh;
}
.image>i {
font-size: 36px !important;
color: #fff !important;
}
.col-6:hover>.image>i {
color: white !important;
}
.box>.icon:hover>.info {
background: rgba(0, 0, 0, 0.04);
border-color: #e0e0e0;
color: white;
}
.box>.icon>.info>h3.title {
font-family: "Montserrat", sans-serif !important;
font-size: 1.25rem;
color: #222;
font-weight: 500;
}
.info>p {
font-family: "Montserrat", sans-serif !important;
font-size: 16px;
color: #666;
line-height: 1.5em;
margin: 10px;
}
.icon:hover>.info>h3.title,
.icon:hover>.info>p,
.icon:hover>.info>.more>a {
color: #222;
}
.box>.info>.more a {
font-family: "Montserrat", sans-serif !important;
font-size: 12px;
color: #222;
line-height: 12px;
text-transform: uppercase;
text-decoration: none;
}
.icon:hover .info .more>a {
color: #fff;
padding: 6px 8px;
background-color: blue;
}
.box .space {
height: 30px;
}
<link href="https://cdn.jsdelivr.net/npm/bootstrap#5.1.3/dist/css/bootstrap.min.css" rel="stylesheet" integrity="sha384-1BmE4kWBq78iYhFldvKuhfTAU6auU8tT94WrHftjDbrCEXSU1oBoqyl2QvZ6jIW3" crossorigin="anonymous">
<script src="https://cdn.jsdelivr.net/npm/bootstrap#5.1.3/dist/js/bootstrap.bundle.min.js" integrity="sha384-ka7Sk0Gln4gmtz2MlQnikT1wXgYsOg+OMhuP+IlRH9sENBO0LRn5q+8nbTov4+1p" crossorigin="anonymous"></script>
<section style="background-color:#f7f7f7">
<div class="container">
<div class="row pt-mb-5 pt-lg-5 pb-mb-5 pb-lg-5">
<div class="col-6 col-sm-6 col-lg-3 mb-2">
<div class="image" style="line-height:0px;padding-left:2px"><img src="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAGQAAABkAQAAAABYmaj5AAAAAnRSTlMAAHaTzTgAAAATSURBVBgZYxgFo2AUjIJRQFcAAAV4AAHcRQIbAAAAAElFTkSuQmCC" style="max-width:45px;max-height:45px" data-src="https://iili.io/EcctII.webp" decoding="async"
class="lazyload"><noscript><img src="https://iili.io/EcctII.webp" style="max-width:45px;max-height:45px" data-eio="l"></noscript></div>
<div class="icon ">
<div class="box">
<div class="info">
<h3 class="title">BoxHeadline 1</h3>
<p>Lorem ipsum dolor sit amet, consectetur adipiscing elit. Sed in lobortis nisl, vitae iaculis sapien. Phasellus ultrices gravida massa luctus ornare. Suspendisse blandit quam elit, eu imperdiet neque semper. massa luctus ornare. Suspendisse
blandit quam elit, eu imperdiet neque semper</p>
<div class="more">
<a href="/kontakt/" title="Title Link">
Mehr Informationen<i class="fa fa-angle-double-right"></i>
</a>
</div>
</div>
</div>
<div class="space"></div>
</div>
</div>
<div class="col-6 col-sm-6 col-lg-3 mb-2">
<div class="image" style="padding-top:14px;line-height:0px;padding-left:2px"><img src="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAEsAAABLAQAAAAAQNUdHAAAAAnRSTlMAAHaTzTgAAAAQSURBVCjPY2AYBaNgFJAMAAM5AAELGjlgAAAAAElFTkSuQmCC" style="max-width:45px;max-height:45px" data-src="https://iili.io/EcctII.webp" decoding="async"
class="lazyload"><noscript><img src="https://iili.io/EcctII.webp" style="max-width:45px;max-height:45px" data-eio="l"></noscript></div>
<div class="icon ">
<div class="box">
<div class="info">
<h3 class="title">BoxHeadline 2</h3>
<p>Lorem ipsum dolor sit amet, consectetur adipiscing elit. Sed in lobortis nisl, vitae iaculis sapien. Phasellus ultrices gravida massa luctus ornare. Suspendisse blandit quam elit, eu imperdiet neque semper. </p>
</div>
</div>
<div class="space"></div>
</div>
</div>
<div class="col-6 col-sm-6 col-lg-3 mb-2">
<div class="image" style="padding-top:14px;line-height:0px;padding-left:2px"><img src="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAEsAAABLAQAAAAAQNUdHAAAAAnRSTlMAAHaTzTgAAAAQSURBVCjPY2AYBaNgFJAMAAM5AAELGjlgAAAAAElFTkSuQmCC" style="max-width:45px;max-height:45px" data-src="https://iili.io/EcctII.webp" decoding="async"
class="lazyload"><noscript><img src="https://iili.io/EcctII.webp" style="max-width:45px;max-height:45px" data-eio="l"></noscript></div>
<div class="icon ">
<div class="box ">
<div class="info">
<h3 class="title">BoxHeadline 3</h3>
<p>Lorem ipsum dolor sit amet, consectetur adipiscing elit. Sed in lobortis nisl, vitae iaculis sapien. Phasellus ultrices gravida massa luctus ornare. Suspendisse blandit quam elit, eu imperdiet neque semper. ultrices gravida massa luctus
ornare. Suspendisse blandit quam elit, eu imperdiet neque semper. ultrices gravida massa luctus ornare. Suspendisse blandit quam elit, eu imperdiet neque semper. </p>
</div>
</div>
<div class="space"></div>
</div>
</div>
<div class="col-6 col-sm-6 col-lg-3 mb-2">
<div class="image" style="padding-top:14px;line-height:0px;padding-left:2px"><img src="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAGQAAABkAQAAAABYmaj5AAAAAnRSTlMAAHaTzTgAAAATSURBVBgZYxgFo2AUjIJRQFcAAAV4AAHcRQIbAAAAAElFTkSuQmCC" style="max-width:45px;max-height:45px" data-src="https://iili.io/EcctII.webp" decoding="async"
class="lazyload"><noscript><img src="https://iili.io/EcctII.webp" style="max-width:45px;max-height:45px" data-eio="l"></noscript></div>
<div class="icon ">
<div class="box ">
<div class="info">
<h3 class="title">BoxHeadline 4</h3>
<p>Lorem ipsum dolor sit amet, consectetur adipiscing elit. Sed in lobortis nisl, vitae iaculis sapien. Phasellus ultrices gravida massa luctus ornare. Suspendisse blandit quam elit, eu imperdiet neque semper. </p>
</div>
</div>
<div class="space"></div>
</div>
</div>
</div>
</div>
</section>
Add Class Like
<div class="col-6 col-sm-6 col-lg-3">
<div class="box h-100"> /* Add Class Here*/
<div class="icon h-100 d-flex flex-column"> /* Add Class Here*/
<div class="image" style="padding-top:14px;line-height:0px;padding-left:2px"><img src="data:/EcctII.webp" decoding="async" class="lazyload"><noscript><img src="https://iili.io/EcctII.webp" style="max-width:45px;max-height:45px" data-eio="l"></noscript></div>
<div class="info flex-fill"> /* Add Class Here*/
<h3 class="title">BoxHeadline 4</h3>
Please update by this code. We make full height using height : 100%
.box > .icon { text-align: center; position: relative; }
.box > .icon > .image { position: relative; z-index: 2; margin: auto; width: 88px; height: 88px; border: 8px solid white; line-height: 88px; border-radius: 50%; background: blue; vertical-align: middle; }
.box > .icon:hover > .image { background: #333; }
.box > .icon > .image > i { font-size: 36px !important; color: #fff !important; }
.box > .icon:hover > .image > i { color: white !important; }
.box > .icon > .info { margin-top: -24px; padding: 40px 0 10px 0; }
.box > .icon:hover > .info { border-color: #e0e0e0; color: white; }
.box > .icon > .info > h3.title { font-family: "Montserrat",sans-serif !important; font-size: 1.25rem; color: #222; font-weight: 500; }
.box > .icon > .info > p { font-family: "Montserrat",sans-serif !important; font-size: 16px; color: #666; line-height: 1.5em; margin: 20px;}
.box > .icon:hover > .info > h3.title, .box > .icon:hover > .info > p, .box > .icon:hover > .info > .more > a { color: #222; }
.box > .icon > .info > .more a { font-family: "Montserrat",sans-serif !important; font-size: 12px; color: #222; line-height: 12px; text-transform: uppercase; text-decoration: none; }
.box > .icon:hover > .info > .more > a { color: #fff; padding: 6px 8px; background-color: blue; }
.box .space { height: 30px; }
.box {
position: relative;
height: 100%;
background: #ddd;
}
.box:hover{background: rgba(0, 0, 0, 0.04); }
.col-6{ margin-bottom:20px;}
<link href="https://cdn.jsdelivr.net/npm/bootstrap#5.1.3/dist/css/bootstrap.min.css" rel="stylesheet" integrity="sha384-1BmE4kWBq78iYhFldvKuhfTAU6auU8tT94WrHftjDbrCEXSU1oBoqyl2QvZ6jIW3" crossorigin="anonymous">
<script src="https://cdn.jsdelivr.net/npm/bootstrap#5.1.3/dist/js/bootstrap.bundle.min.js" integrity="sha384-ka7Sk0Gln4gmtz2MlQnikT1wXgYsOg+OMhuP+IlRH9sENBO0LRn5q+8nbTov4+1p" crossorigin="anonymous"></script>
<section style="background-color:#f7f7f7">
<div class="container">
<div class="row pt-mb-5 pt-lg-5 pb-mb-5 pb-lg-5">
<div class="col-6 col-sm-6 col-lg-3">
<div class="box ">
<div class="icon ">
<div class="image" style="padding-top:14px;line-height:0px;padding-left:2px"><img src="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAGQAAABkAQAAAABYmaj5AAAAAnRSTlMAAHaTzTgAAAATSURBVBgZYxgFo2AUjIJRQFcAAAV4AAHcRQIbAAAAAElFTkSuQmCC" style="max-width:45px;max-height:45px" data-src="https://iili.io/EcctII.webp" decoding="async" class="lazyload"><noscript><img src="https://iili.io/EcctII.webp" style="max-width:45px;max-height:45px" data-eio="l"></noscript></div>
<div class="info">
<h3 class="title">BoxHeadline 1</h3>
<p>
<p>Lorem ipsum dolor sit amet, consectetur adipiscing elit. Sed in lobortis nisl, vitae iaculis sapien. Phasellus ultrices gravida massa luctus ornare. Suspendisse blandit quam elit, eu imperdiet neque semper. massa luctus ornare. Suspendisse blandit quam elit, eu imperdiet neque semper</p>
</p>
<div class="more">
<a href="/kontakt/" title="Title Link">
Mehr Informationen<i class="fa fa-angle-double-right"></i>
</a>
</div>
</div>
</div>
<div class="space"></div>
</div>
</div>
<div class="col-6 col-sm-6 col-lg-3">
<div class="box ">
<div class="icon ">
<div class="image" style="padding-top:14px;line-height:0px;padding-left:2px"><img src="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAEsAAABLAQAAAAAQNUdHAAAAAnRSTlMAAHaTzTgAAAAQSURBVCjPY2AYBaNgFJAMAAM5AAELGjlgAAAAAElFTkSuQmCC" style="max-width:45px;max-height:45px" data-src="https://iili.io/EcctII.webp" decoding="async" class="lazyload"><noscript><img src="https://iili.io/EcctII.webp" style="max-width:45px;max-height:45px" data-eio="l"></noscript></div>
<div class="info">
<h3 class="title">BoxHeadline 2</h3>
<p>
<p>Lorem ipsum dolor sit amet, consectetur adipiscing elit. Sed in lobortis nisl, vitae iaculis sapien. Phasellus ultrices gravida massa luctus ornare. Suspendisse blandit quam elit, eu imperdiet neque semper. </p>
</p>
</div>
</div>
<div class="space"></div>
</div>
</div>
<div class="col-6 col-sm-6 col-lg-3">
<div class="box ">
<div class="icon ">
<div class="image" style="padding-top:14px;line-height:0px;padding-left:2px"><img src="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAEsAAABLAQAAAAAQNUdHAAAAAnRSTlMAAHaTzTgAAAAQSURBVCjPY2AYBaNgFJAMAAM5AAELGjlgAAAAAElFTkSuQmCC" style="max-width:45px;max-height:45px" data-src="https://iili.io/EcctII.webp" decoding="async" class="lazyload"><noscript><img src="https://iili.io/EcctII.webp" style="max-width:45px;max-height:45px" data-eio="l"></noscript></div>
<div class="info">
<h3 class="title">BoxHeadline 3</h3>
<p>
<p>Lorem ipsum dolor sit amet, consectetur adipiscing elit. Sed in lobortis nisl, vitae iaculis sapien. Phasellus ultrices gravida massa luctus ornare. Suspendisse blandit quam elit, eu imperdiet neque semper. ultrices gravida massa luctus ornare. Suspendisse blandit quam elit, eu imperdiet neque semper. ultrices gravida massa luctus ornare. Suspendisse blandit quam elit, eu imperdiet neque semper. </p>
</p>
</div>
</div>
<div class="space"></div>
</div>
</div>
<div class="col-6 col-sm-6 col-lg-3">
<div class="box ">
<div class="icon ">
<div class="image" style="padding-top:14px;line-height:0px;padding-left:2px"><img src="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAGQAAABkAQAAAABYmaj5AAAAAnRSTlMAAHaTzTgAAAATSURBVBgZYxgFo2AUjIJRQFcAAAV4AAHcRQIbAAAAAElFTkSuQmCC" style="max-width:45px;max-height:45px" data-src="https://iili.io/EcctII.webp" decoding="async" class="lazyload"><noscript><img src="https://iili.io/EcctII.webp" style="max-width:45px;max-height:45px" data-eio="l"></noscript></div>
<div class="info">
<h3 class="title">BoxHeadline 4</h3>
<p>
<p>Lorem ipsum dolor sit amet, consectetur adipiscing elit. Sed in lobortis nisl, vitae iaculis sapien. Phasellus ultrices gravida massa luctus ornare. Suspendisse blandit quam elit, eu imperdiet neque semper. </p>
</p>
</div>
</div>
<div class="space"></div>
</div>
</div>
</div>
</div>
</section>

How to get colums side by side on large screens and under each other on smaller screens in bootstrap 4?

I have two columns within a row, but they're not side by side. They are within another div column that is within another row, but that shouldn't matter, should it? Columns should always be side by side unless coded otherwise. How can I make sure the columns are next to each other in larger screens and underneath each other on smaller screens? I tried the order-* tag, but that didn't work. I'm only a beginner, so apologies is this is easy to fix, but I can't figure it out myself.
It looks like this now, the text should be next to the picture on the right side:
enter image description here
This is the code:
.recept-bereiding {
color: #9a084d;
margin-left: 0px;
margin-right: 50px;
}
.recept-bereiding p {
font-size: 0.85rem !important;
}
.steps {
padding-left: 0px;
list-style-type: none;
color: #9a084d;
font-size: 0.9em;
counter-reset: step-counter calc(var(--start) - 1);
}
.steps img {
padding-bottom: 5px;
}
.steps ol {
counter-reset: step-counter;
}
.steps li {
counter-increment: step-counter;
counter-reset: none;
}
.steps li::before {
content: counter(step-counter);
background-color: #7dc623;
margin-right: 5px;
padding: 4px 8px;
font-size: 0.9em;
font-weight: bold;
color: #ffffff;
border-radius: 100%;
}
<div class="container ">
<div class="row d-flex justify-content-center">
<div class="col-md-8 recept-bereiding">
<h3>Omschrijving</h3>
<p>Lorem ipsum dolor sit amet, consectetur adipiscing elit. Sed finibus odio id augue ornare scelerisque. Quisque porta tempor velit, in viverra urna euismod in. Nulla nec efficitur turpis. Quisque at.</p>
<h3>Bereidingswijze</h3>
<row>
<div class="col-md-3 p-0 steps">
<img src="https://i.imgur.com/SJAUllt.jpg" alt=""/>
</div>
<div class="col-md-9 p-0">
<ol style="counter-reset: step-counter 0" start="1" class="steps">
<li>Vestibulum rhoncus egestas lectus quis vulputate. Vestibulum rutrum, ipsum vel vestibulum suscipit, sem lorem malesuada ex, a.</li>
</ol>
</div>
</row>
</div>
<div class="col-md-3 receptside">
</div>
</div>
</div>
well,
Columns should always be side by side unless coded otherwise
isn't always true and it depends on the viewport dimensions.
I would code it like this :
<div class="container">
<div class="row">
<div class="col-md-4 recept-bereiding">
<h3>Omschrijving</h3>
<p>Lorem ipsum dolor sit amet, consectetur adipiscing elit. Sed finibus odio id augue ornare scelerisque. Quisque porta tempor velit, in viverra urna euismod in. Nulla nec efficitur turpis. Quisque at.</p>
<h3>Bereidingswijze</h3>
</div>
<div class="col-md-4 p-0 steps">
<img src="https://i.imgur.com/SJAUllt.jpg" alt="" class="img-fluid"/>
</div>
<div class="col-md-4 p-0">
<ol style="counter-reset: step-counter 0" start="1" class="steps">
<li>Vestibulum rhoncus egestas lectus quis vulputate. Vestibulum rutrum, ipsum vel vestibulum suscipit, sem lorem malesuada ex, a.</li>
</ol>
</div>
<div class="col-md-4 receptside">
</div>
</div>
</div>
</div>
consider the following points:
Do not use row tag in your html. row is a bootstrap class and must be treated as
<div class="row">
ending tags do not need classes as in:
</div class="row">
use bootstrap responsive numbers accordingly.
<div class="col-md-4"
means it will occupy 4 parts of the 12 available space given to its div on a medium sized screen
Can change <row> to <div class="row">. When in fullscreen, the column will show side by side.
.recept-bereiding {
color: #9a084d;
margin-left: 0px;
margin-right: 50px;
}
.recept-bereiding p {
font-size: 0.85rem !important;
}
.steps {
padding-left: 0px;
list-style-type: none;
color: #9a084d;
font-size: 0.9em;
counter-reset: step-counter calc(var(--start) - 1);
}
.steps img {
padding-bottom: 5px;
}
.steps ol {
counter-reset: step-counter;
}
.steps li {
counter-increment: step-counter;
counter-reset: none;
}
.steps li::before {
content: counter(step-counter);
background-color: #7dc623;
margin-right: 5px;
padding: 4px 8px;
font-size: 0.9em;
font-weight: bold;
color: #ffffff;
border-radius: 100%;
}
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/4.4.1/css/bootstrap.min.css">
<div class="container ">
<div class="row d-flex justify-content-center">
<div class="col-md-8 recept-bereiding">
<h3>Omschrijving</h3>
<p>Lorem ipsum dolor sit amet, consectetur adipiscing elit. Sed finibus odio id augue ornare scelerisque. Quisque porta tempor velit, in viverra urna euismod in. Nulla nec efficitur turpis. Quisque at.</p>
<h3>Bereidingswijze</h3>
<div class="row">
<div class="col-md-3 p-0 steps">
<img src="https://i.imgur.com/SJAUllt.jpg" alt=""/>
</div>
<div class="col-md-9 p-0">
<ol style="counter-reset: step-counter 0" start="1" class="steps">
<li>Vestibulum rhoncus egestas lectus quis vulputate. Vestibulum rutrum, ipsum vel vestibulum suscipit, sem lorem malesuada ex, a.</li>
</ol>
</div>
</div>
</div>
<div class="col-md-3 receptside">
</div>
</div>
</div>

Responsive layout with bootstrap

I try to make my first page. I'm learning coding but I have problems with a responsive display. I'm making with Bootstrap, I want to make my layout responsive in all way.
But this is hard for me as I'm starting and learning to code.
.fromtop{
padding-top: 30px;
}
#media (max-width: 767px){
.fromtop{
padding: 0px;
} }
.circle{
border-radius: 50%;
width: 250px;
height: 250px;
background: red;
color: white;
}
#media (max-width: 1199px){
.circle{
border-radius: 50%;
width: 230px;
height: 230px;
background: red;
color: white;
}
}
#media (max-width: 1000px){
.circle{
border-radius: 50%;
width: 210px;
height: 210px;
background: red;
color: white;
}
}
#media (max-width: 850px){
.circle{
border-radius: 50%;
width: 190px;
height: 190px;
background: red;
color: white;
}
}
.text-inner {
text-align: center;
display: inline-block;
}
.number{
font-size: 110px;
width: 100%;
margin-top: 89px;
}
#media (max-width: 991px) {
.number{
font-size: 110px;
width: 100%;
margin-top: 0px;
} }
#media (max-width: 421px) {
.number-3{
font-size: 110px;
width: 100%;
margin-top: -50px;
} }
.middle{
padding-top: 50px;
}
.white-text{
font-size: 20px;
color: rgb(255, 255, 255);
text-align: center;
}
.nop{
margin-top: 0px;
}
.totop{
margin-top: -45px;
}
.arrow{
margin-top: 100px;
}
.under-number {
margin-left: 80px;
}
<section class="well-md bg-white white">
<div class="container inset-6">
<h2 class="text-bold text-center red">Lorem ipsum</h2>
<div class="row">
<div class="col-lg-3 col-md-4 col-sm-3">
<div class="circle">
<p class="number text-bold text-inner">1.</p>
<p class="text-bold under-number">Lorem</p>
</div>
</div>
<div class="text-left col-lg-9 col-md-8 col-sm-9">
<h3 class="text-bold big-grey goright">Lorem ipsum</h3>
<p class="grey goright">Lorem ipsum dolor sit amet, consectetur adipiscing elit. Suspendisse tristique mattis arcu a ullamcorper. In hac habitasse platea dictumst. In a nibh a urna condimentum aliquet egestas sed nulla. Sed molestie ligula id enim placerat suscipit. Sed sit amet semper purus.</p>
</div>
</div>
<img src="images/arrow.png">
<div class="row totop">
<div class="text-right col-lg-9 col-md-9 col-sm-9">
<h3 class="text-bold big-grey">Lorem ipsum</h3>
<p class="grey">Lorem ipsum dolor sit amet, consectetur adipiscing elit. Suspendisse tristique mattis arcu a ullamcorper. In hac habitasse platea dictumst. In a nibh a urna condimentum aliquet egestas sed nulla. Sed molestie ligula id enim placerat suscipit. Sed sit amet semper purus.</p>
</div>
<div class="col-lg-3 col-md-3 col-sm-3">
<div class="circle">
<p class="number text-bold text-inner">2.</p>
<p class="text-bold under-number">Lorem</p>
</div>
</div>
</div>
<img src="images/arrow2.png" class="pull-right">
<div class="row arrow">
<div class="col-sm-3">
<div class="circle">
<p class="number text-bold text-inner number-3">3.</p>
<p class="text-bold under-number">Lorem</p>
</div>
</div>
<div class="text-left col-md-9">
<h3 class="text-bold big-grey goright">Lorem ipsum</h3>
<p class="grey goright">Lorem ipsum dolor sit amet, consectetur adipiscing elit. Suspendisse tristique mattis arcu a ullamcorper. In hac habitasse platea dictumst. In a nibh a urna condimentum aliquet egestas sed nulla. Sed molestie ligula id enim placerat suscipit. Sed sit amet semper purus.</p>
</div>
</div>
</div>
</section>

inexplicable space gap in page

I need help with an invisible/inexplicable space gap in my webpage, in the screen screenshots below you can see the space (the red area):
I need that they behavior just like the other row below "LMP" and "LMB"
In Safari the space gap is not present, but in chrome and firefox this space appears, ain honestly I don't kow what to do, i detected that the container class with a width:80% desapears the gap, but then the page becomes too thin.
Here is a
JSfiddle
IF anyone has the same problem, above the titles I have a header, in this I missed a /div so the next row was complete crazy...thanks to all for helping me, i really apreciate the help
You need to make <div class="row">
before any col-md/col-lg/col-sm Because Bootstrap keep 15px Padding for this.
Update jsfiddle solution:
Update solution in codepen Link
And Update Snipper
/***** 3.- NEWS AND CONTENT *******/
.news-section {
background-color: #F1EFEF;
height: 1500px;
}
.black-title {
margin-top: 50px;
height: 60px;
width:112%;
margin-left: -15px;
background-color: #4A90E2;
text-align: center;
line-height: 60px;
}
.black-title > h3 {
vertical-align: middle;
}
.white-title {
margin-top: 50px;
height: 60px;
margin-left: -15px;
background-color: #3F444A;
color: #fff;
text-align: center;
line-height: 60px;
}
.white-title > h3 {
vertical-align: middle;
}
.title-section-2 {
margin-top:0px;
height: 100%;
}
.news-content {
margin-top: 25px;
display: block;
}
.news-content img {
margin:auto;
background-color: #F1EFEF;
}
.news-link {
text-align: right;
margin: 10px;
}
.news-link a {
color: #E7BF3A;
text-decoration: none;
}
.spot-horizontal {
height: 90px;
margin-top: 10px;
background-color: #BD10E0;
}
.logos-horizontal {
height: 50px;
background-color: #3F444A;
}
<link href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css" rel="stylesheet"/>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
<section>
<div class="container">
<div class="row">
<div class="news-section">
<div class="col-md-6 col-sm-6">
<div class="row">
<h3 class=" black-title">Lo más nuevo</h3>
<div class="news-content">
<img class="img-responsive" src="http://placehold.it/500x400" alt="" >
</div>
</div>
</div>
<div class="col-md-6 col-sm-6">
<div class="row">
<h3 class="white-title">Videos más nuevos</h3>
<div class="news-content">
<img class="img-responsive" src="http://placehold.it/500x400" alt="" >
</div>
</div>
</div>
<div class="col-md-12 spot-horizontal">
<div class="row">
<h3 class="title-black">PUBLICIDAD</h3>
</div>
</div>
<div class="col-md-6 col-sm-6">
<div class="row">
<h3 class=" black-title title-section-2">LMB</h3>
<div class="news-content">
<h4>Titulo de noticia</h4>
<p>Lorem ipsum dolor sit amet, consectetur adipiscing elit. Aenean molestie aliquet tristique. Proin aliquam neque quis est sagittis, tempus sagittis tortor mattis. Praesent nec gravida.</p>
<h4>Titulo de noticia</h4>
<p>Lorem ipsum dolor sit amet, consectetur adipiscing elit. Aenean molestie aliquet tristique. Proin aliquam neque quis est sagittis, tempus sagittis tortor mattis. Praesent nec gravida.</p>
<div class="news-link">
Más Noticias
</div>
</div>
</div>
</div>
<div class="col-md-6 col-sm-6">
<div class="row">
<h3 class="white-title title-section-2">LMP</h3>
<div class="news-content">
<h4>Titulo de noticia</h4>
<p>Lorem ipsum dolor sit amet, consectetur adipiscing elit. Aenean molestie aliquet tristique. Proin aliquam neque quis est sagittis, tempus sagittis tortor mattis. Praesent nec gravida.</p>
<h4>Titulo de noticia</h4>
<p>Lorem ipsum dolor sit amet, consectetur adipiscing elit. Aenean molestie aliquet tristique. Proin aliquam neque quis est sagittis, tempus sagittis tortor mattis. Praesent nec gravida.</p>
<div class="news-link">
Más Noticias
</div>
</div>
</div>
</div>
<div class="col-md-12 logos-horizontal">
<div class="row">
<h3 class="white-title title-section-2">LOGOS</h3>
</div>
</div>
</div>
</div>
</div>
</section>
Both divs have to be inline-block and have the same parent.
Here's a fiddle: https://jsfiddle.net/fbrh1464/6