I am using an amalgamation of the various posts here and the w3c tutorial on making flip cards work with bootstrap 4.
I have it working execpt for the back face is not the same height as the front face. (I have yet to add meaningful text to the back) I am sure I am missing something like adding a H-100 somewhere but can't seem to get to where I am going wrong.
Could any of you see any issues in my code?
<a href="" class="">
<div class="card-flip">
<div class="card-flip-inner">
<div class="card-flip-front">
<div class="card shadow-sm">
<div class="card-body">
<div class="row">
<div class="col text-center">
<i class="fas fa-route fa-3x text-msp-orange"></i>
</div>
<div class="col-10 text-right">
<h3 class="text-msp-darkblue text-uppercase mb-0"><b><?php echo $log->post_title; ?></b></h3>
<p class="text-secondary mt-0">
<?php echo $log->post_description; ?>
</p>
</div>
</div>
<hr />
<div class="row">
<div class="col">
<p class="text-secondary text-justify mb-0 pb-0">
<?php echo shortenEcho($log->post_body, 250); ?>
</p>
<span class="text-secondary float-right mt-0 pt-0"><?php echo date('D jS F Y', strtotime($log->post_createdOn)); ?></span>
</div>
</div>
</div>
<div class="card-footer">
<div class="row">
<div class="col-sm-12 col-md-12 col-lg-4 col-xl-4 text-center text-secondary card-vertical-divider">
<i class="fas fa-wind fa-2x text-msp-lightblue"></i><br />
<b>Force 4</b>
</div>
<div class="col-sm-12 col-md-12 col-lg-4 col-xl-4 text-center text-secondary card-vertical-divider">
<i class="fas fa-water fa-2x text-msp-lightblue"></i><br />
<b>Moderate</b>
</div>
<div class="col-sm-12 col-md-12 col-lg-4 col-xl-4 text-secondary text-center">
<i class="fas fa-cloud-sun fa-2x text-msp-lightblue"></i><br />
<b>Sunny</b>
</div>
</div>
</div>
</div>
</div>
<div class="card-flip-back h-100">
<div class="card shadow-sm bg-msp-lightblue">
<div class="card-body text-white h-100">
some text
</div>
</div>
</div>
</div>
</div>
</a>
And my CSS is...
.card-flip {
perspective: 1000px;
}
.card-flip-inner {
position: relative;
width: 100%;
height: 100%;
transition: transform 0.8s;
transform-style: preserve-3d;
backface-visibility: hidden;
}
/* Do an horizontal flip when you move the mouse over the flip box container */
.card-flip:hover .card-flip-inner {
transform: rotateY(180deg);
}
/* Position the front and back side */
.card-flip-front, .card-flip-back {
width: 100%;
height: 100%;
-webkit-backface-visibility: hidden; /* Safari */
backface-visibility: hidden;
}
/* Style the back side */
.card-flip-back {
transform: rotateY(180deg);
position: absolute;
top: 0;
left: 0;
}
UPDATE: I think I have found the answer...
I have added a H-100 to the <div class="card h-100 shadow-sm">
And also to the...
<div class="card-flip-back">
<div class="card shadow-sm h-100 bg-msp-lightblue">
<div class="card-body mx-auto text-white h-100">
some text
</div>
</div>
Just need to center the text in the card vertically now and we are all good :-)
CSS flip card with bootstrap 4
.flip-card {
width: 300px;
height: 300px;
perspective: 1000px;
transition: 0.3s;
}
.flip-card-inner {
position: relative;
width: 100%;
height: 100%;
text-align: center;
transition: transform 0.6s;
transform-style: preserve-3d;
box-shadow: 0 4px 8px 0 rgba(0,0,0,0.2);
}
.flip-card:hover .flip-card-inner {
transform: rotateY(180deg);
box-shadow: 0 8px 16px 0 rgba(0,0,0,0.2);
}
.flip-card-front, .flip-card-back {
position: absolute;
width: 100%;
height: 100%;
-webkit-backface-visibility: hidden;
backface-visibility: hidden;
}
.flip-card-back {
transform: rotateY(180deg);
}
<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">
<div class="flip-card">
<div class="flip-card-inner">
<div class="flip-card-front">
<div class="card shadow-sm">
<div class="card-flip-front">
<div class="card shadow-sm">
<div class="card-body">
<div class="row">
<div class="col text-center">
<i class="fas fa-route fa-3x text-msp-orange"></i>
</div><!-- end col-->
<div class="col-10 text-right">
<h3 class="text-msp-darkblue text-uppercase mb-0"><b></b></h3>
<p class="text-secondary mt-0"> </p>
</div><!-- end col-10-->
</div><!-- end row -->
<hr />
<div class="row">
<div class="col">
<p class="text-secondary text-justify mb-0 pb-0"> </p>
<span class="text-secondary float-right mt-0 pt-0"></span>
</div><!-- end col-->
</div><!-- end row -->
</div><!-- end card body -->
<div class="card-footer">
<div class="row">
<div class="col-sm-12 col-md-12 col-lg-4 col-xl-4 text-center text-secondary card-vertical-divider">
<i class="fas fa-wind fa-2x text-msp-lightblue"></i><br />
<b>Force 4</b>
</div><!-- end col-sm-12 col-md-12 col-lg-4 col-xl-4-->
<div class="col-sm-12 col-md-12 col-lg-4 col-xl-4 text-center text-secondary card-vertical-divider">
<i class="fas fa-water fa-2x text-msp-lightblue"></i><br />
<b>Moderate</b>
</div><!-- end col-sm-12 col-md-12 col-lg-4 col-xl-4-->
<div class="col-sm-12 col-md-12 col-lg-4 col-xl-4 text-secondary text-center">
<i class="fas fa-cloud-sun fa-2x text-msp-lightblue"></i><br />
<b>Sunny</b>
</div><!-- end col-sm-12 col-md-12 col-lg-4 col-xl-4-->
</div><!-- end row -->
</div><!-- end card footer -->
</div><!-- end card -->
</div><!-- end card flip front -->
</div><!-- end card -->
</div><!-- end card flip front -->
<div class="flip-card-back">
<div class="card shadow-sm ">
<div class="card-body text-dark h-100">
some text
</div><!-- end card body -->
</div><!-- end card -->
</div><!-- end card flip back -->
</div><!-- end card flip inner -->
</div><!-- end card flip -->
Related
Working on my website, thought myself Boostrap5 and super happy about the outcome so far, but I want that the name appears vertically on hover over the images on the bottom left, but I am not sure where I am going wrong in my code. The text is placed very low and to the edge of the grid column.
I'm sure I'm going wrong with the position: attribute or something.
.theteam img {
cursor: pointer;
}
.theteam img:hover {
opacity: 0.8;
}
.project {
position: relative;
overflow: hidden;
}
.project .overlay {
position: absolute;
top: 0;
left: 0;
width: 100%;
height: 100%;
padding: 30px;
display: flex;
align-items: flex-end;
transition: all 0.4s ease;
opacity: 0;
}
.project img {
transition: all 0.4s ease;
}
.project:hover .overlay {
opacity: 1;
}
.project:hover img {
transform: scale(1.1);
}
.text-vertical {
transform-origin: 0 0;
transform: rotate(90deg);
}
<link href="https://cdn.jsdelivr.net/npm/bootstrap#5.0.2/dist/css/bootstrap.min.css" rel="stylesheet" integrity="sha384-EVSTQN3/azprG1Anm3QDgpJLIm9Nao0Yz1ztcQTwFspd3yD65VohhpuuCOmLASjC" crossorigin="anonymous">
<section id="about" class="about bg-dark p-5">
<div class="container text-center mt-5">
<h4 class="text-light text-capitalize mb-0">The rocking team</h4>
<img src="https://poyo-pat-333.netlify.app/images/underline.png" alt="______"></span>
</div>
<div class="container theteam mt-5">
<div class="row g-4 text-center">
<div class="col-md-3 col-sm-6 project inline-block overlay">
<img src="https://poyo-pat-333.netlify.app/images/poyo_moya.jpg" alt="team">
<div class="text-center">
<h6 class="text-white text-vertical position-absolute">Poyo Moya</h6>
</div>
</div>
<div class="col-md-3 col-sm-6 project">
<img src="https://poyo-pat-333.netlify.app/images/regi-villardell.jpg" alt="team">
<div>
<div>
<h6 class="text-white text-vertical">Regi Vilardell</h6>
</div>
</div>
</div>
<div class="col-md-3 col-sm-6 project">
<img src="https://poyo-pat-333.netlify.app/images/oriol_fontanals.jpg" alt="team">
<div>
<div>
<h6 class="text-white text-vertical">Oriol Fontanals</h6>
</div>
</div>
</div>
<div class="col-md-3 col-sm-6 project">
<img src="https://poyo-pat-333.netlify.app/images/Patrick_obrien.jpg" alt="team">
<div class="">
<div>
<h6 class="text-white text-vertical">Patrick O'Brien</h6>
</div>
</div>
</div>
</div>
</div>
</section>
Thanks.
I've made updates to your .text-vertical, take a look:
UPD: I've made .text-top class to align text to top of the image.
.theteam img {
cursor: pointer;
}
.theteam img:hover {
opacity: 0.8;
}
.project {
position: relative;
overflow: hidden;
}
.project .overlay {
position: absolute;
top: 0;
left: 0;
width: 100%;
height: 100%;
padding: 30px;
display: flex;
align-items: flex-end;
transition: all 0.4s ease;
opacity: 0;
}
.project img {
transition: all 0.4s ease;
}
.project:hover .overlay {
opacity: 1;
}
.project:hover img {
transform: scale(1.1);
}
.text-vertical {
transform-origin: 0 0;
transform: rotate(270deg);
/* here */
width: fit-content;
/* this line is important */
}
/* top align for vertical text */
.text-vertical.text-top {
position: absolute;
top: 0;
left: 0;
transform: rotate(-90deg) translate3D(-100%, 0, 0);
}
<link href="https://cdn.jsdelivr.net/npm/bootstrap#5.0.2/dist/css/bootstrap.min.css" rel="stylesheet" integrity="sha384-EVSTQN3/azprG1Anm3QDgpJLIm9Nao0Yz1ztcQTwFspd3yD65VohhpuuCOmLASjC" crossorigin="anonymous">
<section id="about" class="about bg-dark p-5">
<div class="container text-center mt-5">
<h4 class="text-light text-capitalize mb-0">The rocking team</h4>
<img src="https://poyo-pat-333.netlify.app/images/underline.png" alt="______">
</div>
<div class="container theteam mt-5">
<div class="row g-4 text-center">
<div class="col-md-3 col-sm-6 project inline-block overlay">
<img src="https://poyo-pat-333.netlify.app/images/poyo_moya.jpg" alt="team">
<div class="text-center">
<h6 class="text-white text-vertical position-absolute">Poyo Moya</h6>
</div>
</div>
<div class="col-md-3 col-sm-6 project">
<img src="https://poyo-pat-333.netlify.app/images/regi-villardell.jpg" alt="team">
<div>
<div>
<h6 class="text-white text-vertical">Regi Vilardell</h6>
</div>
</div>
</div>
<div class="col-md-3 col-sm-6 project">
<img src="https://poyo-pat-333.netlify.app/images/oriol_fontanals.jpg" alt="team">
<div>
<div>
<h6 class="text-white text-vertical">Oriol Fontanals</h6>
</div>
</div>
</div>
<div class="col-md-3 col-sm-6 project">
<img src="https://poyo-pat-333.netlify.app/images/Patrick_obrien.jpg" alt="team">
<div class="">
<div>
<h6 class="text-white text-vertical">Patrick O'Brien</h6>
</div>
</div>
</div>
</div>
</div>
<div class="container theteam mt-5">
<div class="row g-4 text-center">
<div class="col-md-3 col-sm-6 project inline-block overlay">
<img src="https://poyo-pat-333.netlify.app/images/poyo_moya.jpg" alt="team">
<div class="text-center">
<h6 class="text-white text-vertical text-top">Poyo Moya</h6>
</div>
</div>
<div class="col-md-3 col-sm-6 project">
<img src="https://poyo-pat-333.netlify.app/images/regi-villardell.jpg" alt="team">
<div>
<div>
<h6 class="text-white text-vertical text-top">Regi Vilardell</h6>
</div>
</div>
</div>
<div class="col-md-3 col-sm-6 project">
<img src="https://poyo-pat-333.netlify.app/images/oriol_fontanals.jpg" alt="team">
<div>
<div>
<h6 class="text-white text-vertical text-top">Oriol Fontanals</h6>
</div>
</div>
</div>
<div class="col-md-3 col-sm-6 project">
<img src="https://poyo-pat-333.netlify.app/images/Patrick_obrien.jpg" alt="team">
<div class="">
<div>
<h6 class="text-white text-vertical text-top">Patrick O'Brien</h6>
</div>
</div>
</div>
</div>
</div>
</section>
I was creating a layout which worked in the latest updated browsers (Firefox, Chrome, ...) and then opened the layout in IE 11 and saw a difference. My layout in IE looks like this:
But in every other tested browser the space on the right sided divs is evenly between them, which means that the third div stays on the bottom, while the second divs is right in the middle. I can't get it working in IE 11 and hoped that someone from here has a good advice.
https://jsfiddle.net/1gq2cj3f/2/
<article class="col-12 content-wrapper">
<div class="row content-wrapper-materials">
<div class="col-12 col-lg-6 materials-sectors">
<div class="card materials-sectors-general">
<div class="row no-gutters">
<div class="col-12">
<header class="card-header">
<div class="card-image">
<a href="...">
<img class="card-img-top" src="..." alt="" width="568px" height="430px">
</a>
</div>
<div class="card-img-overlay">
<h3 class="card-title">
Allgemein </h3>
</div>
</header>
</div>
</div>
</div>
</div>
<div class="col-12 col-lg-6 materials-sectors">
<div class="materials-sectors-specific">
<div class="card specific-construction">
<div class="row no-gutters">
<div class="col-12 col-sm-4">
<header class="card-header">
<div class="card-image">
<a href="...">
<img class="card-img-top" src="..." alt="" width="190px" height="117px">
</a>
<div class="card-img-overlay">
<h3 class="card-title">
Headline </h3>
</div>
</div>
</header>
</div>
<div class="col-12 col-sm-8">
<div class="card-body" itemprop="description">
<p class="card-text">
Text </p>
</div>
</div>
</div>
</div>
<div class="card specific-healthcare">
<div class="row no-gutters">
<div class="col-12 col-sm-4">
<header class="card-header">
<div class="card-image">
<a href="...">
<img class="card-img-top" src="..." alt="" width="190px" height="117px">
</a>
<div class="card-img-overlay">
<h3 class="card-title">
Headline </h3>
</div>
</div>
</header>
</div>
<div class="col-12 col-sm-8">
<div class="card-body" itemprop="description">
<p class="card-text">
Text </p>
</div>
</div>
</div>
</div>
<div class="card specific-ict">
<div class="row no-gutters">
<div class="col-12 col-sm-4">
<header class="card-header">
<div class="card-image">
<a href="...">
<img class="card-img-top" src="..." alt="" width="190px" height="117px">
</a>
<div class="card-img-overlay">
<h3 class="card-title">
Headline </h3>
</div>
</div>
</header>
</div>
<div class="col-12 col-sm-8">
<div class="card-body" itemprop="description">
<p class="card-text">
Text </p>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</article>
.content-wrapper > div {
max-width: 1200px;
margin-right: auto;
margin-left: auto;
padding-top: 8rem;
padding-bottom: 8rem;
}
.card > * {
flex: 0 0 auto;
}
.materials-sectors .card-header {
height: 100%;
padding: 0;
border-bottom: 0;
background-color: rgba(242, 241, 241, 1) !important;
}
.materials-sectors .card-image {
height: 100%;
}
.materials-sectors .card-img-top {
-o-object-fit: cover;
object-fit: cover;
}
.materials-sectors-general .card-img-overlay {
bottom: 2rem;
padding: 0.75rem;
}
.materials-sectors .card-img-overlay {
background-color: rgba(255, 255, 255, 0.25);
top: auto;
}
.card-img-overlay > h3 {
font-size: 1rem;
margin-bottom: 0;
}
.materials-sectors-specific {
display: -webkit-box;
display: -ms-flexbox;
display: flex;
-webkit-box-orient: vertical;
-webkit-box-direction: normal;
-ms-flex-flow: column;
flex-flow: column;
-webkit-box-pack: justify;
-ms-flex-pack: justify;
justify-content: space-between;
}
.materials-sectors-specific > .card {
height: 100%;
}
.materials-sectors-specific .card-image {
display: block;
}
.materials-sectors-specific > div:nth-of-type(2) {
margin-top: 1rem;
margin-bottom: 1rem;
}
I have a carousel faq, there are some boxes with different questions and answers, so the boxes are not the same size as you can see above:
My code is this one:
<section id="faq" class="shadow-lg">
<div class="container text-center">
<h3 class="font-weight-light">Faq</h3>
<div class="row mx-auto my-auto">
<div id="recipeCarousel" class="col carousel slide w-100" data-ride="carousel">
<div class="row carousel-inner w-100" role="listbox">
<div class="carousel-item active">
<div class="col-md-4">
<div class="card card-body">
<h4 class="card-title">pergunta</h4>
<p class="card-text">resposta</p>
</div>
</div>
</div>
<div class="carousel-item">
<div class="col-md-4">
<div class="card card-body">
<h4 class="card-title">pergunta</h4>
<p class="card-text">resposta</p>
</div>
</div>
</div>
</div>
<a class="carousel-control-prev w-auto" href="#recipeCarousel" role="button" data-slide="prev">
<span class="carousel-control-prev-icon bg-dark border border-dark rounded-circle"
aria-hidden="true"></span>
<span class="sr-only">Previous</span>
</a>
<a class="carousel-control-next w-auto" href="#recipeCarousel" role="button" data-slide="next">
<span class="carousel-control-next-icon bg-dark border border-dark rounded-circle"
aria-hidden="true"></span>
<span class="sr-only">Next</span>
</a>
</div>
</div>
</div>
</section>
css:
.carousel-inner .carousel-item.active,
.carousel-inner .carousel-item-next,
.carousel-inner .carousel-item-prev {
display: flex;
}
#faq{
padding-bottom: 80px;
}
#faq h3{
padding-top: 50px;
padding-bottom: 50px;
}
#faq .card{
border-color: #216869;
min-height: 400px;
}
#infos, #contato, #faq, #planos{
font-family: Montserrat-Regular;
font-size: 14px;
line-height: 1.7;
color: #666666;
margin: 0px;
}
I want the boxes to be at the same height, regardless of the size of the questions. Basically, I want all the boxes to be the same height as the largest.
How can I make this angular8 component fill the whole height?
The Root Style.scss has this
html, body, app-root {
min-height: 100vh;
height: auto;
margin: 0;
}
The left green bar (DIV) needs to fill the height of the screen
.nav-left-container {
width: var(--nav-left-w) // 6rem;
height: 100vh;
background-color: var(--col-green-blue);
position: absolute;
top: 0;
left: 0;
}
HTML
<div class="nav-left-container">
<div class="nav-logo-container d-flex justify-content-center align-items-center">
<a [routerLink]="['/home']" routerLinkActive="" (click)=toHome()><img class="nav-logo-img"" alt=" "></a>
</div>
<div class="navigation-container d-flex justify-content-start align-items-center flex-column">
<div class="home d-flex justify-content-center align-items-center mt-4 mb-5">
<a [routerLink]="['/home']" routerLinkActive="" tooltip="Home" placement="right" (click)="toHome()"><img class="nav-link-img" src="../../../assets/images/ui/home.png" alt="home"></a>
</div>
<div class="search d-flex justify-content-center align-items-center mb-5">
<a [routerLink]="['/products']" routerLinkActive="" tooltip="Search" placement="right" (click)="toSearch()"><img class="nav-link-img" src="../../../assets/images/ui/barcode_search.png" alt="search"></a>
</div>
<div class="history d-flex justify-content-center align-items-center mb-5">
<a [routerLink]="['/history']" routerLinkActive="" tooltip="History" placement="right" (click)="toHistory()"><img class="nav-link-img" src="../../../assets/images/ui/history.png" alt="history"></a>
</div>
<div class="settingsd-flex justify-content-center align-items-center mb-5">
<a [routerLink]="['/settings']" routerLinkActive="" tooltip="Settings" placement="right" (click)="toSettings()"><img class="nav-link-img" src="../../../assets/images/ui/settings.png" alt="settings"></a>
</div>
</div>
</div>
The main container of the page (home and notifications (grey) have this
.home-container {
width: calc(100% - var(--nav-left-w)) // to avoid horizontal scroll;
height: 100vh;
margin-left: 6rem;
}
HTML
.home-container {
width: calc(100% - var(--nav-left-w));
height: 100vh;
margin-left: 6rem;
}
<app-nav-top></app-nav-top>
<div class="container-fluid home-container">
<div class="row">
<div class="col-md-9">
<div class="row mt-4">
<div class="col">
<div class="find-resource-wrapper mt-4">
<a (click)="onFindResource()">
<h1>Find a resource <fa-icon [icon]="faSearchPlus"></fa-icon>
</h1>
</a>
<hr>
<div class="find-resource-display-wrapper">
<app-resource-list></app-resource-list>
</div>
</div>
</div>
</div>
<!-- end find resource -->
<div class="row mt-4">
<div class="col">
<div class="offer-resource-wrapper">
<a>
<h1>Offer resource <fa-icon [icon]="faSearchPlus"></fa-icon>
</h1>
</a>
<hr>
</div>
</div>
</div>
<!-- end offer resource -->
<div class="row mt-4">
<div class="col">
<div class="cycles-wrapper">
<a>
<h1>Cycles <fa-icon [icon]="faRecycle"></fa-icon></h1>
</a>
<hr>
</div>
</div>
</div>
<!-- end cycles -->
</div>
<!-- end main left -->
<div class="col-md-3 notification-area">
<div class="row">
<div class="col">
<div class="mt-4">Logged in as</div>
<div>
<fa-icon [icon]="faEnvelope"></fa-icon> {{email}}
</div>
</div>
</div>
</div>
</div>
<!-- end notification -->
</div>
<!-- end home-container -->
<app-nav-left></app-nav-left>
How can I get the green bar to fill the whole height of the screen?
Thank you in advance.
try to make change in your css I am sure it will work.
.nav-left-container {
width: var(--nav-left-w) // 6rem;
background-color: var(--col-green-blue);
position: absolute;
top: 0;
left: 0;
bottom: 0;
}
I'm trying to center the content, vertical and horizontal. I'm having some problems with the vertical part: Working Plunker
My custom css card:
.customCard {
width: 15rem;
height: 7rem;
background-color: blue;
color:#eee;
}
<link href="https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0-beta/css/bootstrap.min.css" rel="stylesheet"/>
<div class="card-deck">
<div class="card-block ">
<div class="card customCard mt-2 customCursorPointer">
<div class="card-body">
<div class="container d-flex r h-100">
<div class="row justify-content-center mx-auto align-items-center">
<h4 class="card-title">AAAA</h4>
</div>
</div>
</div>
</div>
</div>
</div>
You need to add height:100% in .card-body
.customCard {
width: 15rem;
height: 7rem;
background-color: blue;
color:#eee;
}
.card-body {
height: 100%;
}
<link href="https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0-beta/css/bootstrap.min.css" rel="stylesheet"/>
<div class="card-deck">
<div class="card-block ">
<div class="card customCard mt-2 customCursorPointer">
<div class="card-body">
<div class="container d-flex r h-100">
<div class="row justify-content-center mx-auto align-items-center">
<h4 class="card-title">AAAA</h4>
</div>
</div>
</div>
</div>
</div>
</div>