How to fit images set like facebook in bootstrap css & angular 7 - css

I want to fit images set like facebook photo albums showing in newsfeed.
When I'm trying this it will show with huge spaces.
here is my code
html code
<div class="pCollection">
<div class="row pCollection-header">
<div *ngFor="let photo of getPhotos(); let i=index" class="col-md-6">
<div *ngIf="photos.length > 4">
<div *ngIf="i != 3">
<div class="card">
<div class="card-img-wrapper">
<img class="card-img-top" (click)="open(i)" src="{{photo.src}}" alt="">
<div class="overlay">
<p *ngIf="i == 3" class="restImages"> + {{photos.length - 4}}</p>
</div>
</div>
</div>
</div>
<div *ngIf="i == 3">
<div class="card">
<div class="card-img-wrapper">
<img class="card-img-top" (click)="open(i)" src="{{photo.src}}" alt="">
<div class="overlay">
<p class="restImages"> + {{photos.length - 4}}</p>
</div>
</div>
</div>
</div>
</div>
<div *ngIf="photos.length < 5">
<div class="card">
<div class="card-img-wrapper">
<img class="card-img-top" (click)="open(i)" src="{{photo.src}}" alt="">
</div>
</div>
</div>
</div>
</div></div>
this is my css code
.pCollection-header .col-md-6 {
padding-left: 0;
padding-right:0;
}
.pCollection {
overflow: hidden;
}
.card{
cursor: pointer;
}
.card-img-wrapper {
position: relative;
/* background: rgba(0, 0, 0, 0.7); */
}
.card-img-wrapper img{
background: rgba(0, 0, 0, 0.7);
}
.overlay{
position: absolute;
top: 35%;
left: 36%;
z-index: 1000;
}
.restImages {
color: #fff;
font-size: 35px;
}
#media (min-width: 576px) {
.restImages {
font-size: 24px;
}
}
#media (min-width: 768px) {
.restImages {
font-size: 24px;
}
}
#media (min-width: 992px) {
.restImages {
font-size: 35px;
}
}
#media (min-width: 1200px) {
.restImages {
font-size: 35px;
}
}
this is the screenshot for this code
this is the screenshot for what I'm expecting
please anyone know how to do this,please help me.I wasted few days for this issue.

You can use jQuery plugin for this if you want. You can see the demo it's exactly what you want.

Try this CSS for the stackblitz which you created...
p {
font-family: Lato;
}
.paddingReset>div{
padding:0;
}
.img-responsive-custom{
max-width: 100%;
display:block;
height: auto;
}
.left-set>img{
border-right:2px;
border-bottom: 0px;
border-left:2px;
border-style: solid;
border-color: #fff;
}
.right-set>img{
border-top:1px;
border-right:2px;
border-left:2px;
border-style: solid;
border-color: #fff;
}
.column9Custom{width:75%;}
.column3Custom{width:25%;}

Related

Banner image not shown in angular page

I am still learning about angular so I might not have the best design, but anyways I get confused not being so sure where my css should be. I have src/index.html, styles.css and src/app/app.component.html, app.component.html. I am trying to customize home.component.html, no home.component.css has been implemented. On .parallax-container I am trying to show an image, but not showing as a background image.
src/styles.css
div.sm-jumbotron {
padding: 2rem;
background-color: #38547b;
color: #ffffff;
}
button.btn-submit {
background-color: #38547b;
color: #ffffff;
width: 100%;
}
button.btn-submit:focus, button.btn-submit:hover {
background-color: #38547b;
}
input.ng-invalid.ng-dirty {
border-bottom-color: #e91e63 !important;
box-shadow: 0 1px 0 0 #e91e63 !important;
}
nav ul a,
nav .brand-logo {
color: #444;
}
p {
line-height: 2rem;
}
.sidenav-trigger {
color: #26a69a;
}
.parallax-container {
min-height: 380px;
line-height: 0;
height: auto;
color: rgba(0, 0, 0, 0.9);
}
.parallax-container .section {
width: 100%;
}
#media only screen and (max-width : 992px) {
.parallax-container .section {
position: absolute;
top: 40%;
}
#index-banner .section {
top: 10%;
}
}
#media only screen and (max-width : 600px) {
#index-banner .section {
top: 0;
}
}
.icon-block {
padding: 0 15px;
}
.icon-block .material-icons {
font-size: inherit;
}
footer.page-footer {
margin: 0;
}
app.component.html
<div class="container" [style.margin-top.px]="navbarTopMargin">
<app-nav (navHeight)="onNavHeight($event)"></app-nav>
</div>
<div id="container">
<div class="my-custom-container" [style.margin-top.px]="routerOutput">
<router-outlet></router-outlet>
</div>
</div>
home.component.html
<div id="index-banner" class="parallax-container">
<div class="section no-pad-bot">
<div class="container">
<br><br>
<h1 class="header center teal-text text-lighten-2">Join Us</h1>
<div class="row center">
<h3 class="header col s12 light">We sell and deliver products to customers that will improve health.</h3>
</div>
<div class="row center">
Get Started
</div>
</div>
</div>
<!--Show this image-->
<div class="parallax"><img src="https://mdbootstrap.com/img/Photos/Others/architecture.jpg" alt=""></div>
</div>
<div class="container">
<div class="section">
<div class="row">
<div class="col s12 m4">
<div class="icon-block">
<h2 class="center brown-text"><i class="material-icons">flash_on</i></h2>
<h3 class="center">Fast delivery</h3>
<p class="light">
We are the fastest delivery service in America.
</p>
</div>
</div>
<div class="col s12 m4">
<div class="icon-block">
<h2 class="center brown-text"><i class="material-icons">group</i></h2>
<h3 class="center">Top quality</h3>
<p class="light">
We make sure the quality is great.
</p>
</div>
</div>
<div class="col s12 m4">
<div class="icon-block">
<h2 class="center brown-text"><i class="material-icons">location_city</i></h2>
<h3 class="center">Trusted company</h3>
<p class="light">
This company has received 98% satisfaction.
</p>
</div>
</div>
</div>
Please try this css in your style.css:
.parallax-container .parallax{
position: static;
}
.parallax-container .parallax img{
position: static;
transform: none;
display: block;
max-width: 100%;
}

How to full the width of content of a row using bootstrap

Hi All can someone help me with the Web App I'm creating.
Here is the screenshot Web App Screenshot of web app so far i want to Maximize the Creative Tim Material Dashboard Content
I want to Maximize the Text Converter card
Actually there is an Angualar template like this.
But i'm learning Web Development using Angular. I learn by solving error and doing things than learning by reading.
So i use the bootstrap template then applied it in the Angular app.
This is the code for the dashboard
<body class="">
<div class="wrapper ">
<div class="sidebar" data-color="purple" data-background-color="white" data-image="../assets/img/sidebar-1.jpg">
<!--
Tip 1: You can change the color of the sidebar using: data-color="purple | azure | green | orange | danger"
Tip 2: you can also add an image using data-image tag
-->
<div class="logo">
<a href="http://www.creative-tim.com" class="simple-text logo-normal">
Creative Tim
</a>
</div>
<div class="sidebar-wrapper">
<ul class="nav">
<app-nav></app-nav>
</ul>
</div>
</div>
<div class="main-panel">
<!-- Navbar -->
<nav class="navbar navbar-expand-lg navbar-transparent navbar-absolute fixed-top ">
<div class="container-fluid">
<div class="navbar-wrapper">
<a class="navbar-brand">Dashboard</a>
</div>
</div>
</nav>
<!-- End Navbar -->
<div class="content">
<div class="container-fluid">
<div class="row">
<router-outlet></router-outlet>
</div>
</div>
</div>
</div>
</div>
</body>
And the code for the textconverter component
<div class="row">
<div class="col-lg-12">
<div class="card">
<div class="card-header card-header-primary">
<h4 class="card-title">Text Converter</h4>
<p class="card-category">(Multiline to Single line) or (Single line to Multiline)</p>
</div>
<div class="card-body">
<form>
<div class="row">
<div class="col-lg-6">
<div class="form-group">
<label class="bmd-label-floating">Fist Name</label>
<input type="text" class="form-control">
</div>
</div>
<div class="col-lg-6">
<div class="form-group">
<label class="bmd-label-floating">Last Name</label>
<input type="text" class="form-control">
</div>
</div>
</div>
<button type="submit" class="btn btn-primary pull-right">Update Profile</button>
<div class="clearfix"></div>
</form>
</div>
</div>
</div>
</div>
but why does it not full screen? Even if i use the class class="col-lg-12"
But when the code is using two div class like in the code below.
<div class="row">
<div class="col-lg-10">
<div class="card">
<div class="card-header card-header-primary">
<h4 class="card-title">Text Converter</h4>
<p class="card-category">(Multiline to Single line) or (Single line to Multiline)</p>
</div>
<div class="card-body">
<form>
<div class="row">
<div class="col-lg-6">
<div class="form-group">
<label class="bmd-label-floating">Fist Name</label>
<input type="text" class="form-control">
</div>
</div>
<div class="col-lg-6">
<div class="form-group">
<label class="bmd-label-floating">Last Name</label>
<input type="text" class="form-control">
</div>
</div>
</div>
<button type="submit" class="btn btn-primary pull-right">Update Profile</button>
<div class="clearfix"></div>
</form>
</div>
</div>
</div>
<div class="col-lg-2">
<div class="card card-profile">
<div class="card-avatar">
<a href="#pablo">
<img class="img" src="../assets/img/faces/marc.jpg" />
</a>
</div>
<div class="card-body">
<h6 class="card-category text-gray">CEO / Co-Founder</h6>
<h4 class="card-title">Alec Thompson</h4>
<p class="card-description">
Don't be scared of the truth because we need to restart the human foundation in truth And I love you like Kanye loves Kanye I love Rick Owens’ bed design but the back is...
</p>
Follow
</div>
</div>
</div>
</div>
It became like this.
It became full screen. Please see the screenshot below:
Full Screen row
Update:
Here is the code from the css class
.card {
position: relative;
display: flex;
flex-direction: column;
min-width: 0;
word-wrap: break-word;
background-color: #fff;
background-clip: border-box;
border: 1px solid #eeeeee;
border-radius: 0.25rem;
}
.card>hr {
margin-right: 0;
margin-left: 0;
}
.card>.list-group:first-child .list-group-item:first-child {
border-top-left-radius: 0.25rem;
border-top-right-radius: 0.25rem;
}
.card>.list-group:last-child .list-group-item:last-child {
border-bottom-right-radius: 0.25rem;
border-bottom-left-radius: 0.25rem;
}
.card-body {
flex: 1 1 auto;
padding: 1.25rem;
}
.card-title {
margin-bottom: 0.75rem;
}
.card-subtitle {
margin-top: -0.375rem;
margin-bottom: 0;
}
.card-text:last-child {
margin-bottom: 0;
}
.card-link:hover {
text-decoration: none;
}
.card-link+.card-link {
margin-left: 1.25rem;
}
.card-header {
padding: 0.75rem 1.25rem;
margin-bottom: 0;
background-color: #fff;
border-bottom: 1px solid #eeeeee;
}
.card-header:first-child {
border-radius: calc(0.25rem - 1px) calc(0.25rem - 1px) 0 0;
}
.card-header+.list-group .list-group-item:first-child {
border-top: 0;
}
.card-footer {
padding: 0.75rem 1.25rem;
background-color: #fff;
border-top: 1px solid #eeeeee;
}
.card-footer:last-child {
border-radius: 0 0 calc(0.25rem - 1px) calc(0.25rem - 1px);
}
.card-header-tabs {
margin-right: -0.625rem;
margin-bottom: -0.75rem;
margin-left: -0.625rem;
border-bottom: 0;
}
.card-header-pills {
margin-right: -0.625rem;
margin-left: -0.625rem;
}
.card-img-overlay {
position: absolute;
top: 0;
right: 0;
bottom: 0;
left: 0;
padding: 1.25rem;
}
.card-img {
width: 100%;
border-radius: calc(0.25rem - 1px);
}
.card-img-top {
width: 100%;
border-top-left-radius: calc(0.25rem - 1px);
border-top-right-radius: calc(0.25rem - 1px);
}
.card-img-bottom {
width: 100%;
border-bottom-right-radius: calc(0.25rem - 1px);
border-bottom-left-radius: calc(0.25rem - 1px);
}
.card-deck {
display: flex;
flex-direction: column;
}
.card-deck .card {
margin-bottom: 15px;
}
#media (min-width: 576px) {
.card-deck {
flex-flow: row wrap;
margin-right: -15px;
margin-left: -15px;
}
.card-deck .card {
display: flex;
flex: 1 0 0%;
flex-direction: column;
margin-right: 15px;
margin-bottom: 0;
margin-left: 15px;
}
}
.card-group {
display: flex;
flex-direction: column;
}
.card-group>.card {
margin-bottom: 15px;
}
#media (min-width: 576px) {
.card-group {
flex-flow: row wrap;
}
.card-group>.card {
flex: 1 0 0%;
margin-bottom: 0;
}
.card-group>.card+.card {
margin-left: 0;
border-left: 0;
}
.card-group>.card:first-child {
border-top-right-radius: 0;
border-bottom-right-radius: 0;
}
.card-group>.card:first-child .card-img-top,
.card-group>.card:first-child .card-header {
border-top-right-radius: 0;
}
.card-group>.card:first-child .card-img-bottom,
.card-group>.card:first-child .card-footer {
border-bottom-right-radius: 0;
}
.card-group>.card:last-child {
border-top-left-radius: 0;
border-bottom-left-radius: 0;
}
.card-group>.card:last-child .card-img-top,
.card-group>.card:last-child .card-header {
border-top-left-radius: 0;
}
.card-group>.card:last-child .card-img-bottom,
.card-group>.card:last-child .card-footer {
border-bottom-left-radius: 0;
}
.card-group>.card:only-child {
border-radius: 0.25rem;
}
.card-group>.card:only-child .card-img-top,
.card-group>.card:only-child .card-header {
border-top-left-radius: 0.25rem;
border-top-right-radius: 0.25rem;
}
.card-group>.card:only-child .card-img-bottom,
.card-group>.card:only-child .card-footer {
border-bottom-right-radius: 0.25rem;
border-bottom-left-radius: 0.25rem;
}
.card-group>.card:not(:first-child):not(:last-child):not(:only-child) {
border-radius: 0;
}
.card-group>.card:not(:first-child):not(:last-child):not(:only-child) .card-img-top,
.card-group>.card:not(:first-child):not(:last-child):not(:only-child) .card-img-bottom,
.card-group>.card:not(:first-child):not(:last-child):not(:only-child) .card-header,
.card-group>.card:not(:first-child):not(:last-child):not(:only-child) .card-footer {
border-radius: 0;
}
}
.card-columns .card {
margin-bottom: 0.75rem;
}
#media (min-width: 576px) {
.card-columns {
column-count: 3;
column-gap: 1.25rem;
}
.card-columns .card {
display: inline-block;
width: 100%;
}
}
What do i need to change in the code?
Thank you

Boostrap css put image as overlay in header

I am trying to put a image inside a header in a boostrap card, I do know there are other questions like this but I seriously tried everything.
Here is the code:
<div class="container">
<div style="padding: 20px 0px;" *ngFor="let blog of blogs">
<div class="card">
<div class="card-header" (click)="navigate('Blog')">
<a (click)="navigate(blog.title)">{{ blog.title }}</a>
</div>
<div class="card-body">
<p class="card-text">
{{ blog.summary }}
</p>
</div>
</div>
</div>
</div>
css:
.card-header {
background: rgba(0, 255, 0, 0.61);
color: rgb(0, 0, 0);
font-weight: bold;
cursor: pointer;
}
.card-body {
background: #43484d;
}
.card-text {
color: #6cffce;
font-weight: bold;
}
I have tried
background-image: url(imagepath)
it does not work
I also tried
<image src ...>
as top-overlay but that neither
I just want to put an image in the header which will be transparent with on the top a color (kind of like looking into a glass type of thing)
not exactly sure what you want. check this snippet if it gives you any ideas.
.card-header {
background: linear-gradient(rgba(255, 0, 0, 0.25), rgba(255, 0, 0, 0.25)), url(http://www.tedgoas.com/assets/images/work/stack-overflow/cover.jpg) no-repeat center center;
height: 200px;
position: relative;
}
.card-header a {
color: white;
font-weight: bold;
font-size: 50px;
position: absolute;
top: 40%;
left: 40%;
}
.card-body {
background: #43484d;
}
.card-text {
color: #6cffce;
font-weight: bold;
}
<div class="container">
<div>
<div class="card">
<div class="card-header">
<a>Header</a>
</div>
<div class="card-body">
<p class="card-text">
Body
</p>
</div>
</div>
</div>
</div>
Here is your code as per your requirement see the code card-header same thing you can apply in anywhere it will work fine. here is link codepen link here
<div class="container">
<div style="padding: 20px 0px;" *ngFor="let blog of blogs">
<div class="card">
<div class="card-header" (click)="navigate('Blog')">
<a (click)="navigate(blog.title)">link</a>
</div>
<div class="card-body">
<p class="card-text">
Para1
</p>
</div>
</div>
</div>
</div>
Css goes here...
html, body {
height: 100%;
width: 100%;
margin: 0;
color: #f9f0f3;
background: #D21237;
}
.card-header {
background: rgba(0, 255, 0, 0.61);
color: rgb(0, 0, 0);
font-weight: bold;
cursor: pointer;
position:relative;
height:10vh;
}
.card-header::before{
content:"";
background-image: url("http://www.hdnicewallpapers.com/Walls/Big/Abstract/Red_and_Blue_Smoke_Creative_Design_Wallpaper.jpg");
height:10vh;
position: absolute;
top:0px;
width:100%;
z-index:99999;
}
.card-body {
background: #43484d;
}
.card-text {
color: #6cffce;
font-weight: bold;
}

Small margin that I cannot remove Bootstrap

UPDATE: Fixed - I had neglected to wrap my blog partial within <main> tags, which are in place on every other page. Moderators: please delete question if you deem appropriate. I'll leave it here for now.
I've been trying for some time to remove the small margin that appears on the right side of the top image (.mobile-image). I know the placement of the image is poor but it has to be that way to allow for fluid resizing on mobile. I've tried manipulating negative margin values to no avail.
The issue is isolated to the top image but I have put the full HTML so the broader context is there if necessary.
/*Single blog post template*/
//Blog header
.blog-jumbo-header{
margin-top: 80px;
padding-left: 150px;
padding-right: 100px;
padding-bottom: 20px;
#include media-breakpoint-down(md) {
padding:5% 3% 5% 3%;
}
}
.background-wrapper{
background-color: #e3e7f2;
#include media-breakpoint-down(md) {
margin-bottom: 1em;
}
}
.single-blog-page-body {
margin-top: 70px;
#include media-breakpoint-up(md) {
padding-left: 165px;
}
#include media-breakpoint-down(md) {
padding-left: 15px;
margin-top:0px;
}
}
.title-block{
#include media-breakpoint-up(xl) {
margin-top: 30px;
padding-right: 80px;
}
#media only screen and (min-width: 1550px) {
margin-top: 30px;
padding-right: 80px;
}
#media only screen and (min-width: 1001px) and (max-width:1150px){
min-width: 350px;
}
#media only screen and (min-width: 1050px) {
padding-top: 50px;
padding-right: 30px;
}
.category{
text-transform: uppercase;
font-weight: 300;
}
.top-heading{
padding-top: 10px;
padding-bottom: 10px;
#media (max-width: 1350px) {
font-size: 44px;
}
}
.blog-lead{
font-size: 1.2em;
font-weight: 300;
line-height: 28px;
}
}
//Images
//Main header image
.blog-image{
padding-right: 40px;
padding-left: 50px;
padding-top: 20px;
width:850px;
#media only screen and (max-width: 1550px){
width:700px;
margin-top: 70px;
}
#media only screen and (max-width: 1400px){
width:650px;
margin-top: 100px;
}
#media only screen and (max-width: 1200px){
width:550px;
margin-top: 100px;
}
#media only screen and (min-width: 1001px) and (max-width:1150px){
width:420px;
}
#media only screen and (max-width: 1000px){
display:none;
}
}
//Main header image, styled full-width for mobile
.mobile-image{
width:100%;
margin: 85px -5px -80px -5px;
#media only screen and (min-width: 999px) {
display: none;
}
}
//Author bubble image
.author-bubble{
width: 70px;
#media only screen and (max-width: 1350px) {
width: 50px;
}
}
<script src="https://stackpath.bootstrapcdn.com/bootstrap/4.2.1/js/bootstrap.min.js"></script>
<link href="https://stackpath.bootstrapcdn.com/bootstrap/4.2.1/css/bootstrap.min.css" rel="stylesheet" />
<div class="background-wrapper">
<!--Mobile full width image starts-->
<img src="https://dummyimage.com/800x450/000/fff.png" class="mobile-image">
<!--Mobile full width image ends-->
<!--Blog jumbo header-->
<div class="jumbotron-fluid blog-jumbo-header">
<div class="container-fluid ">
<!--Title/category flex block-->
<div class="d-flex flex-row ">
<div class="title-block">
<div class="d-flex flex-column">
<!--Category-->
<div class="">
<span class="h5 category">Category</span>
</div>
<!--Post title-->
<div class="">
<h1 class="top-heading display-4">Title</h1>
</div>
<!--Post lead-->
<div class="">
<p class="blog-lead">
Lead lead lead lead lead lead lead lead
</p>
</div>
<!--Author info-->
<div class="d-flex flex-row align-items-center pt-2">
<div class="d-flex flex-column pl-2 ">
<div class="">
<span>
Author
</span>
</div>
<!--Date-->
<div class="">
<span style="font-weight: 300;">
Date
</span>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
<!--Blog image flex block-->
<div class="d-flex flex-row ">
<div class="d-flex flex-column">
<div class=" blog-image">
<img class=" img-fluid" src="{{ site.baseurl }}/assets/images/blog/{{ page.image }}" />
</div>
</div>
</div>
</div>
</div>
</div>

Creating a responsive divider (vertical/horizontal) in Bootstrap

I'm struggling a bit with creating a responsive divider in Bootstrap. By responsive divider I mean a divider which is vertical on large screens and horizontal on smaller screens.
Vertical divider:
Horizontal divider:
This is a simple example how to make a responsive horizontal line with words by Bootstrap 4.1
<link href="https://stackpath.bootstrapcdn.com/bootstrap/4.1.3/css/bootstrap.min.css" rel="stylesheet"/>
<div class="d-flex">
<hr class="my-auto flex-grow-1">
<div class="px-4">SOME TEXT HERE</div>
<hr class="my-auto flex-grow-1">
</div>
This has to be done using a class which can change with media queries. Check this link out for a solution http://www.bootply.com/cwvl8JaIEi. Its basically what you have already with a few additions as follows:
A class for the line
media queries
.sepText {
background: #ffffff;
margin: -15px 0 0 -38px;
padding: 5px 0;
position: absolute;
left: 43%;
text-align: center;
}
hr{-webkit-transform: translate(-45px, -11px) rotate(90deg) scale(0.8);
-ms-transform: translate(-45px, -11px) rotate(90deg) scale(0.8);
transform: translate(-45px, -11px) rotate(90deg) scale(0.8);}
#media only screen and (max-width: 999px) {
hr{
-webkit-transform: none;
-ms-transform: none;
transform: none;
}
.sepText {
left: 50%;
top:50%
}
}
<link href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/css/bootstrap.min.css" rel="stylesheet"/>
<div class="row">
<div class="col-md-5">
<h2>Lorem ipsum</h2>
<p>blah blach hery asd
ad a dsasdadjaudn dadas asd ads a da d ad ad a d ad ad a d<br>asd ads asd da da da dada
</p>
</div>
<div class="col-md-2">
<div class="sep">
<hr><div class="sepText">
OR
</div>
</div>
</div>
<div class="col-md-5">
<h2>Lorem lorem</h2>
<p>ok ok ok</p>
</div>
</div>
The columns really need to be be equal height so Flexbox seems optimal
html {
box-sizing: border-box;
}
*,
*::before,
*::after {
box-sizing: inherit;
margin: 0;
padding: 0;
}
.row {
display: flex;
}
.sep {
display: flex;
flex-direction: column;
justify-content: center;
}
.sepText {
display: flex;
flex-direction: column;
justify-content: center;
align-items: center;
flex: 1;
}
.sepText::before,
.sepText::after {
content: '';
flex: 1;
width: 1px;
background: currentColor;
/* matches font color */
margin: .25em;
}
<link href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/css/bootstrap.min.css" rel="stylesheet" />
<div class="container">
<div class="row">
<div class="col-sm-5">
<h2>Lorem ipsum</h2>
<p>blah blach hery asd ad a dsasdadjaudn dadas asd ads a da d ad ad a d ad ad a d
<br>asd ads asd da da da dada
</p>
</div>
<div class="col-sm-2 sep">
<span class="sepText">
OR
</span>
</div>
<div class="col-sm-5">
<h2>Lorem lorem</h2>
<p>ok ok ok</p>
</div>
</div>
</div>
Codepen Demo
here is working Demo.
HTML
<div class="row">
<div class="col-sm-5"><h2>lorem Ipsum</h2><p>lorem ipsum dummt text is here for you</p></div>
<div class="col-sm-2 seprator_class">
<div class="sep">
<div class="sep-text">
or
</div>
</div>
</div>
<div class="col-sm-5"><h2>lorem Ipsum</h2><p>lorem ipsum dummt text is here for you</p>
</div>
</div>
CSS
.seprator_class {position: relative;}
.sep {position: absolute; left:50%; top:0; bottom:0; width: 1px; background:#ccc; display:table; height:100%;}
.sep-text { display:table-cell; vertical-align:middle; background: #fff; padding: 5px;}
#media screen and (max-width: 768px) {
.sep {position: absolute; left:0; top:50%; bottom:auto; right:0 width: 100%; background:#ccc; display:block; height: 1px; text-align:center;}
.sep-text { display:inline-block;}
}
The answer is disappearing <hr> + disappearing <div> + margin-left: -1px;
<div class="container">
<div class="row">
<div class="col-md-7">
1 of 2
</div>
<div class="border-left d-sm-none d-md-block" style="width: 0px;"></div>
<div class="col-md-5" style="margin-left: -1px;">
<hr class="d-sm-block d-md-none">
2 of 2
</div>
</div>
</div>
https://jsfiddle.net/8z1pag7s/
tested on Bootstrap 4.1
Here is a codepen for an unlimited number of cells : https://codepen.io/pg-dev/pen/vYyKEaN
Code:
var detectWrap = function(className) {
var midLine = [];
var lastLine = [];
var lastColItems = [];
var prevItem = null;
var item = null;
var items = document.getElementsByClassName(className);
for (const [pos, item] of Object.entries(items)) {
if (prevItem != null &&
prevItem.getBoundingClientRect().top < item.getBoundingClientRect().top) {
lastColItems.push(prevItem)
midLine.push(...lastLine)
lastLine = []
}
//Suppose this is the last line, if not (detect a new line) then move last to mid
lastLine.push(item)
if (parseInt(pos, 0) === items.length - 1) {
lastColItems.push(item)
}
prevItem = item;
};
return {
"mid": midLine,
"last": lastLine,
"last-item": lastColItems
};
}
function grid() {
var wrappedItems = detectWrap("item");
var items = document.getElementsByClassName("item");
for ([key, item] of Object.entries(items)) {
item.classList.remove("last-item-of-line")
item.classList.remove("last-line")
item.classList.add("line")
}
for ([key, item] of Object.entries( wrappedItems["last"])) {
item.classList.add("last-line")
}
for ([key, item] of Object.entries(wrappedItems["last-item"])) {
item.classList.add("last-item-of-line")
}
}
window.onresize = function(event){
grid();
};
//when document ready
document.addEventListener('DOMContentLoaded', function() {
grid();
});
body {
background: grey;
}
div {
display: flex;
flex-wrap: wrap;
}
div > div {
flex-grow: 1;
flex-shrink: 1;
justify-content: center;
background-color: #222222;
padding: 20px 0px;
color: #FFFFFF;
font-family: Arial;
min-width: 250px;
}
div > div.wrapped {
background-color: red;
}
.line {
border-top: none;
border-bottom: 1px solid white;
border-right: 1px solid white;
border-left: none;
}
.last-item-of-line {
border-right: none !important;
}
.last-line {
border-top: none;
border-bottom: none;
border-left: none;
border-right: 1px solid white;
}
<div>
<div class="item">A</div>
<div class="item">B</div>
<div class="item">C</div>
<div class="item">D</div>
<div class="item">E</div>
<div class="item">F</div>
<div class="item">G</div>
<div class="item">H</div>
</div>

Resources