Bootsrap Cards: scale to content to fit card-body
I found a bootstrap template, that using css and js, can display bootsrap-cards and flip them, on hover
Css-wise, each card content is held under 2 different DIV tags and nested tags
source
I wanted to edit the back side of each card, but once I do, the backside size changes, in comparison with the front side, so when the card flips, the size of the card will remain the same
I have a JSFiddle with the modifications so far, and the card when each side in a different size
Below is the code
HTML
<!-- Team -->
<section id="team" class="pb-5">
<div class="container">
<h5 class="section-title h1">Test</h5>
<h6><small><a href="test">test</a></small></h6>
<div class="row">
<!-- Team member -->
<!-- Team member -->
<div class="col-xs-12 col-sm-6 col-md-4">
<div class="image-flip" ontouchstart="this.classList.toggle('hover');">
<div class="mainflip">
<div class="frontside">
<div class="card">
<div class="card-body text-center">
<p><img class=" img-fluid" src="https://sunlimetech.com/portfolio/boot4menu/assets/imgs/team/img_03.png" alt="card image"></p>
<h4 class="card-title">Sunlimetech</h4>
<p class="card-text">This is basic card with image on top, title, description and button.</p>
<a href="#" class="btn btn-primary btn-sm"><i class="fa fa-plus"></i></a>
</div>
</div>
</div>
<div class="backside">
<div class="card">
<div class="card-body text-center mt-4">
<ul class="list-group list-group-flush"> <!-- -->
<li class="list-group-item"><a href="https://www.google.com/" class="list-group-item list-group-item-action"><h6>Google</h6></a></li>
<li class="list-group-item"><a href="https://www.google.com/" class="list-group-item list-group-item-action"><h6>Another Google</h6></a></li>
<li class="list-group-item"><a href="https://www.google.com/"><h6>Blah Blah Blah longer text than just "google"</h6></a></li>
<li class="list-group-item"><a href="https://www.google.com/"><h6>Another list Item</h6></a></li>
</ul> <ul class="list-inline">
<li class="list-inline-item">
<a class="social-icon text-xs-center" target="_blank" href="https://www.google.com/">
<i class="fa fa-newspaper-o"></i>
</a>
</li>
<li class="list-inline-item">
<a class="social-icon text-xs-center" target="_blank" href="https://www.linkedin.com/">
<i class="fa fa-linkedin"></i>
</a>
</li>
<li class="list-inline-item">
<a class="social-icon text-xs-center" target="_blank" href="https://www.gmail.com/">
<i class="fa fa-address-book"></i>
</a>
</li>
<li class="list-inline-item">
<a class="social-icon text-xs-center" target="_blank" href="https://twitter.com/">
<i class="fa fa-twitter"></i>
</a>
</li>
<li class="list-inline-item">
<a class="social-icon text-xs-center" target="_blank" href="https://www.facebook.com/">
<i class="fa fa-facebook"></i>
</a>
</li>
</ul>
</div>
</div>
</div>
</div>
</div>
</div>
<!-- ./Team member -->
</div>
</div>
</section>
<!-- Team -->
CSS
/* FontAwesome for working BootSnippet :> */
@import url('https://maxcdn.bootstrapcdn.com/font-awesome/4.7.0/css/font-awesome.min.css');
#team {
background: #eee !important;
}
.btn-primary:hover,
.btn-primary:focus {
background-color: #108d6f;
border-color: #108d6f;
box-shadow: none;
outline: none;
}
.btn-primary {
color: #fff;
background-color: #007b5e;
border-color: #007b5e;
}
section {
padding: 60px 0;
}
section .section-title {
text-align: center;
color: #007b5e;
margin-bottom: 50px;
text-transform: uppercase;
}
#team .card {
border: none;
background: #ffffff;
}
.image-flip:hover .backside,
.image-flip.hover .backside {
-webkit-transform: rotateY(0deg);
-moz-transform: rotateY(0deg);
-o-transform: rotateY(0deg);
-ms-transform: rotateY(0deg);
transform: rotateY(0deg);
border-radius: .25rem;
}
.image-flip:hover .frontside,
.image-flip.hover .frontside {
-webkit-transform: rotateY(180deg);
-moz-transform: rotateY(180deg);
-o-transform: rotateY(180deg);
transform: rotateY(180deg);
}
.mainflip {
-webkit-transition: 1s;
-webkit-transform-style: preserve-3d;
-ms-transition: 1s;
-moz-transition: 1s;
-moz-transform: perspective(1000px);
-moz-transform-style: preserve-3d;
-ms-transform-style: preserve-3d;
transition: 1s;
transform-style: preserve-3d;
position: relative;
}
.frontside {
position: relative;
-webkit-transform: rotateY(0deg);
-ms-transform: rotateY(0deg);
z-index: 2;
margin-bottom: 30px;
}
.backside {
position: absolute;
top: 0;
left: 0;
background: white;
-webkit-transform: rotateY(-180deg);
-moz-transform: rotateY(-180deg);
-o-transform: rotateY(-180deg);
-ms-transform: rotateY(-180deg);
transform: rotateY(-180deg);
-webkit-box-shadow: 5px 7px 9px -4px rgb(158, 158, 158);
-moz-box-shadow: 5px 7px 9px -4px rgb(158, 158, 158);
box-shadow: 5px 7px 9px -4px rgb(158, 158, 158);
}
.frontside,
.backside {
-webkit-backface-visibility: hidden;
-moz-backface-visibility: hidden;
-ms-backface-visibility: hidden;
backface-visibility: hidden;
-webkit-transition: 1s;
-webkit-transform-style: preserve-3d;
-moz-transition: 1s;
-moz-transform-style: preserve-3d;
-o-transition: 1s;
-o-transform-style: preserve-3d;
-ms-transition: 1s;
-ms-transform-style: preserve-3d;
transition: 1s;
transform-style: preserve-3d;
}
.frontside .card,
.backside .card {
min-height: 312px;
}
.backside .card a {
font-size: 18px;
color: #007b5e !important;
}
.frontside .card .card-title,
.backside .card .card-title {
color: #007b5e !important;
}
.frontside .card .card-body img {
width: 120px;
height: 120px;
border-radius: 50%;
}
@import url("https://maxcdn.bootstrapcdn.com/font-awesome/4.7.0/css/font-awesome.min.css");
@import url('https://fonts.googleapis.com/css?family=Open+Sans:300,400,600,700');
@import url('https://fonts.googleapis.com/css?family=Libre+Baskerville:400,700');
body{
font-family: 'Open Sans', sans-serif;
}
*:hover{
-webkit-transition: all 1s ease;
transition: all 1s ease;
}
section{
float:left;
width:100%;
background: #fff; /* fallback for old browsers */
padding:30px 0;
}
h1{float:left; width:100%; color:#232323; margin-bottom:30px; font-size: 14px;}
h1 span{font-family: 'Libre Baskerville', serif; display:block; font-size:45px; text-transform:none; margin-bottom:20px; margin-top:30px; font-weight:700}
h1 a{color:#131313; font-weight:bold;}
css bootstrap-4
add a comment |
I found a bootstrap template, that using css and js, can display bootsrap-cards and flip them, on hover
Css-wise, each card content is held under 2 different DIV tags and nested tags
source
I wanted to edit the back side of each card, but once I do, the backside size changes, in comparison with the front side, so when the card flips, the size of the card will remain the same
I have a JSFiddle with the modifications so far, and the card when each side in a different size
Below is the code
HTML
<!-- Team -->
<section id="team" class="pb-5">
<div class="container">
<h5 class="section-title h1">Test</h5>
<h6><small><a href="test">test</a></small></h6>
<div class="row">
<!-- Team member -->
<!-- Team member -->
<div class="col-xs-12 col-sm-6 col-md-4">
<div class="image-flip" ontouchstart="this.classList.toggle('hover');">
<div class="mainflip">
<div class="frontside">
<div class="card">
<div class="card-body text-center">
<p><img class=" img-fluid" src="https://sunlimetech.com/portfolio/boot4menu/assets/imgs/team/img_03.png" alt="card image"></p>
<h4 class="card-title">Sunlimetech</h4>
<p class="card-text">This is basic card with image on top, title, description and button.</p>
<a href="#" class="btn btn-primary btn-sm"><i class="fa fa-plus"></i></a>
</div>
</div>
</div>
<div class="backside">
<div class="card">
<div class="card-body text-center mt-4">
<ul class="list-group list-group-flush"> <!-- -->
<li class="list-group-item"><a href="https://www.google.com/" class="list-group-item list-group-item-action"><h6>Google</h6></a></li>
<li class="list-group-item"><a href="https://www.google.com/" class="list-group-item list-group-item-action"><h6>Another Google</h6></a></li>
<li class="list-group-item"><a href="https://www.google.com/"><h6>Blah Blah Blah longer text than just "google"</h6></a></li>
<li class="list-group-item"><a href="https://www.google.com/"><h6>Another list Item</h6></a></li>
</ul> <ul class="list-inline">
<li class="list-inline-item">
<a class="social-icon text-xs-center" target="_blank" href="https://www.google.com/">
<i class="fa fa-newspaper-o"></i>
</a>
</li>
<li class="list-inline-item">
<a class="social-icon text-xs-center" target="_blank" href="https://www.linkedin.com/">
<i class="fa fa-linkedin"></i>
</a>
</li>
<li class="list-inline-item">
<a class="social-icon text-xs-center" target="_blank" href="https://www.gmail.com/">
<i class="fa fa-address-book"></i>
</a>
</li>
<li class="list-inline-item">
<a class="social-icon text-xs-center" target="_blank" href="https://twitter.com/">
<i class="fa fa-twitter"></i>
</a>
</li>
<li class="list-inline-item">
<a class="social-icon text-xs-center" target="_blank" href="https://www.facebook.com/">
<i class="fa fa-facebook"></i>
</a>
</li>
</ul>
</div>
</div>
</div>
</div>
</div>
</div>
<!-- ./Team member -->
</div>
</div>
</section>
<!-- Team -->
CSS
/* FontAwesome for working BootSnippet :> */
@import url('https://maxcdn.bootstrapcdn.com/font-awesome/4.7.0/css/font-awesome.min.css');
#team {
background: #eee !important;
}
.btn-primary:hover,
.btn-primary:focus {
background-color: #108d6f;
border-color: #108d6f;
box-shadow: none;
outline: none;
}
.btn-primary {
color: #fff;
background-color: #007b5e;
border-color: #007b5e;
}
section {
padding: 60px 0;
}
section .section-title {
text-align: center;
color: #007b5e;
margin-bottom: 50px;
text-transform: uppercase;
}
#team .card {
border: none;
background: #ffffff;
}
.image-flip:hover .backside,
.image-flip.hover .backside {
-webkit-transform: rotateY(0deg);
-moz-transform: rotateY(0deg);
-o-transform: rotateY(0deg);
-ms-transform: rotateY(0deg);
transform: rotateY(0deg);
border-radius: .25rem;
}
.image-flip:hover .frontside,
.image-flip.hover .frontside {
-webkit-transform: rotateY(180deg);
-moz-transform: rotateY(180deg);
-o-transform: rotateY(180deg);
transform: rotateY(180deg);
}
.mainflip {
-webkit-transition: 1s;
-webkit-transform-style: preserve-3d;
-ms-transition: 1s;
-moz-transition: 1s;
-moz-transform: perspective(1000px);
-moz-transform-style: preserve-3d;
-ms-transform-style: preserve-3d;
transition: 1s;
transform-style: preserve-3d;
position: relative;
}
.frontside {
position: relative;
-webkit-transform: rotateY(0deg);
-ms-transform: rotateY(0deg);
z-index: 2;
margin-bottom: 30px;
}
.backside {
position: absolute;
top: 0;
left: 0;
background: white;
-webkit-transform: rotateY(-180deg);
-moz-transform: rotateY(-180deg);
-o-transform: rotateY(-180deg);
-ms-transform: rotateY(-180deg);
transform: rotateY(-180deg);
-webkit-box-shadow: 5px 7px 9px -4px rgb(158, 158, 158);
-moz-box-shadow: 5px 7px 9px -4px rgb(158, 158, 158);
box-shadow: 5px 7px 9px -4px rgb(158, 158, 158);
}
.frontside,
.backside {
-webkit-backface-visibility: hidden;
-moz-backface-visibility: hidden;
-ms-backface-visibility: hidden;
backface-visibility: hidden;
-webkit-transition: 1s;
-webkit-transform-style: preserve-3d;
-moz-transition: 1s;
-moz-transform-style: preserve-3d;
-o-transition: 1s;
-o-transform-style: preserve-3d;
-ms-transition: 1s;
-ms-transform-style: preserve-3d;
transition: 1s;
transform-style: preserve-3d;
}
.frontside .card,
.backside .card {
min-height: 312px;
}
.backside .card a {
font-size: 18px;
color: #007b5e !important;
}
.frontside .card .card-title,
.backside .card .card-title {
color: #007b5e !important;
}
.frontside .card .card-body img {
width: 120px;
height: 120px;
border-radius: 50%;
}
@import url("https://maxcdn.bootstrapcdn.com/font-awesome/4.7.0/css/font-awesome.min.css");
@import url('https://fonts.googleapis.com/css?family=Open+Sans:300,400,600,700');
@import url('https://fonts.googleapis.com/css?family=Libre+Baskerville:400,700');
body{
font-family: 'Open Sans', sans-serif;
}
*:hover{
-webkit-transition: all 1s ease;
transition: all 1s ease;
}
section{
float:left;
width:100%;
background: #fff; /* fallback for old browsers */
padding:30px 0;
}
h1{float:left; width:100%; color:#232323; margin-bottom:30px; font-size: 14px;}
h1 span{font-family: 'Libre Baskerville', serif; display:block; font-size:45px; text-transform:none; margin-bottom:20px; margin-top:30px; font-weight:700}
h1 a{color:#131313; font-weight:bold;}
css bootstrap-4
add a comment |
I found a bootstrap template, that using css and js, can display bootsrap-cards and flip them, on hover
Css-wise, each card content is held under 2 different DIV tags and nested tags
source
I wanted to edit the back side of each card, but once I do, the backside size changes, in comparison with the front side, so when the card flips, the size of the card will remain the same
I have a JSFiddle with the modifications so far, and the card when each side in a different size
Below is the code
HTML
<!-- Team -->
<section id="team" class="pb-5">
<div class="container">
<h5 class="section-title h1">Test</h5>
<h6><small><a href="test">test</a></small></h6>
<div class="row">
<!-- Team member -->
<!-- Team member -->
<div class="col-xs-12 col-sm-6 col-md-4">
<div class="image-flip" ontouchstart="this.classList.toggle('hover');">
<div class="mainflip">
<div class="frontside">
<div class="card">
<div class="card-body text-center">
<p><img class=" img-fluid" src="https://sunlimetech.com/portfolio/boot4menu/assets/imgs/team/img_03.png" alt="card image"></p>
<h4 class="card-title">Sunlimetech</h4>
<p class="card-text">This is basic card with image on top, title, description and button.</p>
<a href="#" class="btn btn-primary btn-sm"><i class="fa fa-plus"></i></a>
</div>
</div>
</div>
<div class="backside">
<div class="card">
<div class="card-body text-center mt-4">
<ul class="list-group list-group-flush"> <!-- -->
<li class="list-group-item"><a href="https://www.google.com/" class="list-group-item list-group-item-action"><h6>Google</h6></a></li>
<li class="list-group-item"><a href="https://www.google.com/" class="list-group-item list-group-item-action"><h6>Another Google</h6></a></li>
<li class="list-group-item"><a href="https://www.google.com/"><h6>Blah Blah Blah longer text than just "google"</h6></a></li>
<li class="list-group-item"><a href="https://www.google.com/"><h6>Another list Item</h6></a></li>
</ul> <ul class="list-inline">
<li class="list-inline-item">
<a class="social-icon text-xs-center" target="_blank" href="https://www.google.com/">
<i class="fa fa-newspaper-o"></i>
</a>
</li>
<li class="list-inline-item">
<a class="social-icon text-xs-center" target="_blank" href="https://www.linkedin.com/">
<i class="fa fa-linkedin"></i>
</a>
</li>
<li class="list-inline-item">
<a class="social-icon text-xs-center" target="_blank" href="https://www.gmail.com/">
<i class="fa fa-address-book"></i>
</a>
</li>
<li class="list-inline-item">
<a class="social-icon text-xs-center" target="_blank" href="https://twitter.com/">
<i class="fa fa-twitter"></i>
</a>
</li>
<li class="list-inline-item">
<a class="social-icon text-xs-center" target="_blank" href="https://www.facebook.com/">
<i class="fa fa-facebook"></i>
</a>
</li>
</ul>
</div>
</div>
</div>
</div>
</div>
</div>
<!-- ./Team member -->
</div>
</div>
</section>
<!-- Team -->
CSS
/* FontAwesome for working BootSnippet :> */
@import url('https://maxcdn.bootstrapcdn.com/font-awesome/4.7.0/css/font-awesome.min.css');
#team {
background: #eee !important;
}
.btn-primary:hover,
.btn-primary:focus {
background-color: #108d6f;
border-color: #108d6f;
box-shadow: none;
outline: none;
}
.btn-primary {
color: #fff;
background-color: #007b5e;
border-color: #007b5e;
}
section {
padding: 60px 0;
}
section .section-title {
text-align: center;
color: #007b5e;
margin-bottom: 50px;
text-transform: uppercase;
}
#team .card {
border: none;
background: #ffffff;
}
.image-flip:hover .backside,
.image-flip.hover .backside {
-webkit-transform: rotateY(0deg);
-moz-transform: rotateY(0deg);
-o-transform: rotateY(0deg);
-ms-transform: rotateY(0deg);
transform: rotateY(0deg);
border-radius: .25rem;
}
.image-flip:hover .frontside,
.image-flip.hover .frontside {
-webkit-transform: rotateY(180deg);
-moz-transform: rotateY(180deg);
-o-transform: rotateY(180deg);
transform: rotateY(180deg);
}
.mainflip {
-webkit-transition: 1s;
-webkit-transform-style: preserve-3d;
-ms-transition: 1s;
-moz-transition: 1s;
-moz-transform: perspective(1000px);
-moz-transform-style: preserve-3d;
-ms-transform-style: preserve-3d;
transition: 1s;
transform-style: preserve-3d;
position: relative;
}
.frontside {
position: relative;
-webkit-transform: rotateY(0deg);
-ms-transform: rotateY(0deg);
z-index: 2;
margin-bottom: 30px;
}
.backside {
position: absolute;
top: 0;
left: 0;
background: white;
-webkit-transform: rotateY(-180deg);
-moz-transform: rotateY(-180deg);
-o-transform: rotateY(-180deg);
-ms-transform: rotateY(-180deg);
transform: rotateY(-180deg);
-webkit-box-shadow: 5px 7px 9px -4px rgb(158, 158, 158);
-moz-box-shadow: 5px 7px 9px -4px rgb(158, 158, 158);
box-shadow: 5px 7px 9px -4px rgb(158, 158, 158);
}
.frontside,
.backside {
-webkit-backface-visibility: hidden;
-moz-backface-visibility: hidden;
-ms-backface-visibility: hidden;
backface-visibility: hidden;
-webkit-transition: 1s;
-webkit-transform-style: preserve-3d;
-moz-transition: 1s;
-moz-transform-style: preserve-3d;
-o-transition: 1s;
-o-transform-style: preserve-3d;
-ms-transition: 1s;
-ms-transform-style: preserve-3d;
transition: 1s;
transform-style: preserve-3d;
}
.frontside .card,
.backside .card {
min-height: 312px;
}
.backside .card a {
font-size: 18px;
color: #007b5e !important;
}
.frontside .card .card-title,
.backside .card .card-title {
color: #007b5e !important;
}
.frontside .card .card-body img {
width: 120px;
height: 120px;
border-radius: 50%;
}
@import url("https://maxcdn.bootstrapcdn.com/font-awesome/4.7.0/css/font-awesome.min.css");
@import url('https://fonts.googleapis.com/css?family=Open+Sans:300,400,600,700');
@import url('https://fonts.googleapis.com/css?family=Libre+Baskerville:400,700');
body{
font-family: 'Open Sans', sans-serif;
}
*:hover{
-webkit-transition: all 1s ease;
transition: all 1s ease;
}
section{
float:left;
width:100%;
background: #fff; /* fallback for old browsers */
padding:30px 0;
}
h1{float:left; width:100%; color:#232323; margin-bottom:30px; font-size: 14px;}
h1 span{font-family: 'Libre Baskerville', serif; display:block; font-size:45px; text-transform:none; margin-bottom:20px; margin-top:30px; font-weight:700}
h1 a{color:#131313; font-weight:bold;}
css bootstrap-4
I found a bootstrap template, that using css and js, can display bootsrap-cards and flip them, on hover
Css-wise, each card content is held under 2 different DIV tags and nested tags
source
I wanted to edit the back side of each card, but once I do, the backside size changes, in comparison with the front side, so when the card flips, the size of the card will remain the same
I have a JSFiddle with the modifications so far, and the card when each side in a different size
Below is the code
HTML
<!-- Team -->
<section id="team" class="pb-5">
<div class="container">
<h5 class="section-title h1">Test</h5>
<h6><small><a href="test">test</a></small></h6>
<div class="row">
<!-- Team member -->
<!-- Team member -->
<div class="col-xs-12 col-sm-6 col-md-4">
<div class="image-flip" ontouchstart="this.classList.toggle('hover');">
<div class="mainflip">
<div class="frontside">
<div class="card">
<div class="card-body text-center">
<p><img class=" img-fluid" src="https://sunlimetech.com/portfolio/boot4menu/assets/imgs/team/img_03.png" alt="card image"></p>
<h4 class="card-title">Sunlimetech</h4>
<p class="card-text">This is basic card with image on top, title, description and button.</p>
<a href="#" class="btn btn-primary btn-sm"><i class="fa fa-plus"></i></a>
</div>
</div>
</div>
<div class="backside">
<div class="card">
<div class="card-body text-center mt-4">
<ul class="list-group list-group-flush"> <!-- -->
<li class="list-group-item"><a href="https://www.google.com/" class="list-group-item list-group-item-action"><h6>Google</h6></a></li>
<li class="list-group-item"><a href="https://www.google.com/" class="list-group-item list-group-item-action"><h6>Another Google</h6></a></li>
<li class="list-group-item"><a href="https://www.google.com/"><h6>Blah Blah Blah longer text than just "google"</h6></a></li>
<li class="list-group-item"><a href="https://www.google.com/"><h6>Another list Item</h6></a></li>
</ul> <ul class="list-inline">
<li class="list-inline-item">
<a class="social-icon text-xs-center" target="_blank" href="https://www.google.com/">
<i class="fa fa-newspaper-o"></i>
</a>
</li>
<li class="list-inline-item">
<a class="social-icon text-xs-center" target="_blank" href="https://www.linkedin.com/">
<i class="fa fa-linkedin"></i>
</a>
</li>
<li class="list-inline-item">
<a class="social-icon text-xs-center" target="_blank" href="https://www.gmail.com/">
<i class="fa fa-address-book"></i>
</a>
</li>
<li class="list-inline-item">
<a class="social-icon text-xs-center" target="_blank" href="https://twitter.com/">
<i class="fa fa-twitter"></i>
</a>
</li>
<li class="list-inline-item">
<a class="social-icon text-xs-center" target="_blank" href="https://www.facebook.com/">
<i class="fa fa-facebook"></i>
</a>
</li>
</ul>
</div>
</div>
</div>
</div>
</div>
</div>
<!-- ./Team member -->
</div>
</div>
</section>
<!-- Team -->
CSS
/* FontAwesome for working BootSnippet :> */
@import url('https://maxcdn.bootstrapcdn.com/font-awesome/4.7.0/css/font-awesome.min.css');
#team {
background: #eee !important;
}
.btn-primary:hover,
.btn-primary:focus {
background-color: #108d6f;
border-color: #108d6f;
box-shadow: none;
outline: none;
}
.btn-primary {
color: #fff;
background-color: #007b5e;
border-color: #007b5e;
}
section {
padding: 60px 0;
}
section .section-title {
text-align: center;
color: #007b5e;
margin-bottom: 50px;
text-transform: uppercase;
}
#team .card {
border: none;
background: #ffffff;
}
.image-flip:hover .backside,
.image-flip.hover .backside {
-webkit-transform: rotateY(0deg);
-moz-transform: rotateY(0deg);
-o-transform: rotateY(0deg);
-ms-transform: rotateY(0deg);
transform: rotateY(0deg);
border-radius: .25rem;
}
.image-flip:hover .frontside,
.image-flip.hover .frontside {
-webkit-transform: rotateY(180deg);
-moz-transform: rotateY(180deg);
-o-transform: rotateY(180deg);
transform: rotateY(180deg);
}
.mainflip {
-webkit-transition: 1s;
-webkit-transform-style: preserve-3d;
-ms-transition: 1s;
-moz-transition: 1s;
-moz-transform: perspective(1000px);
-moz-transform-style: preserve-3d;
-ms-transform-style: preserve-3d;
transition: 1s;
transform-style: preserve-3d;
position: relative;
}
.frontside {
position: relative;
-webkit-transform: rotateY(0deg);
-ms-transform: rotateY(0deg);
z-index: 2;
margin-bottom: 30px;
}
.backside {
position: absolute;
top: 0;
left: 0;
background: white;
-webkit-transform: rotateY(-180deg);
-moz-transform: rotateY(-180deg);
-o-transform: rotateY(-180deg);
-ms-transform: rotateY(-180deg);
transform: rotateY(-180deg);
-webkit-box-shadow: 5px 7px 9px -4px rgb(158, 158, 158);
-moz-box-shadow: 5px 7px 9px -4px rgb(158, 158, 158);
box-shadow: 5px 7px 9px -4px rgb(158, 158, 158);
}
.frontside,
.backside {
-webkit-backface-visibility: hidden;
-moz-backface-visibility: hidden;
-ms-backface-visibility: hidden;
backface-visibility: hidden;
-webkit-transition: 1s;
-webkit-transform-style: preserve-3d;
-moz-transition: 1s;
-moz-transform-style: preserve-3d;
-o-transition: 1s;
-o-transform-style: preserve-3d;
-ms-transition: 1s;
-ms-transform-style: preserve-3d;
transition: 1s;
transform-style: preserve-3d;
}
.frontside .card,
.backside .card {
min-height: 312px;
}
.backside .card a {
font-size: 18px;
color: #007b5e !important;
}
.frontside .card .card-title,
.backside .card .card-title {
color: #007b5e !important;
}
.frontside .card .card-body img {
width: 120px;
height: 120px;
border-radius: 50%;
}
@import url("https://maxcdn.bootstrapcdn.com/font-awesome/4.7.0/css/font-awesome.min.css");
@import url('https://fonts.googleapis.com/css?family=Open+Sans:300,400,600,700');
@import url('https://fonts.googleapis.com/css?family=Libre+Baskerville:400,700');
body{
font-family: 'Open Sans', sans-serif;
}
*:hover{
-webkit-transition: all 1s ease;
transition: all 1s ease;
}
section{
float:left;
width:100%;
background: #fff; /* fallback for old browsers */
padding:30px 0;
}
h1{float:left; width:100%; color:#232323; margin-bottom:30px; font-size: 14px;}
h1 span{font-family: 'Libre Baskerville', serif; display:block; font-size:45px; text-transform:none; margin-bottom:20px; margin-top:30px; font-weight:700}
h1 a{color:#131313; font-weight:bold;}
css bootstrap-4
css bootstrap-4
asked Nov 14 '18 at 15:22
Guy LouzonGuy Louzon
783416
783416
add a comment |
add a comment |
1 Answer
1
active
oldest
votes
I suggest you to use matchHeight:
First, put this in footer
<script type="text/javascript" src="https://cdnjs.cloudflare.com/ajax/libs/jquery.matchHeight/0.7.2/jquery.matchHeight-min.js"></script>
Second, put this in footer (next to code above)
$(".card").matchHeight();
It'll work, upvote and accept my answer if it works, or let me know that it doesn't work
Here is the demo:
https://codepen.io/Lincox/pen/RqpERa
Thanks for the answer. and if it works, don't worry about it ;)
– Guy Louzon
Nov 14 '18 at 16:28
You're welcome. Don't forget to upvote and accept my answer as a right answer. Thank you.
– Luu Hoang Bac
Nov 14 '18 at 16:32
That works ! any way I can have the card to be set with a max size, so that the content would shrink accordingly ?
– Guy Louzon
Nov 15 '18 at 6:48
1
I'm not sure that I understand your idea, but in your case above, you just simply putwidth: 500px
in the class.frontside
and.backside
like this:.frontside, .backside{ width: 500px; }
you can change the number 500px
– Luu Hoang Bac
Nov 15 '18 at 15:27
add a comment |
Your Answer
StackExchange.ifUsing("editor", function () {
StackExchange.using("externalEditor", function () {
StackExchange.using("snippets", function () {
StackExchange.snippets.init();
});
});
}, "code-snippets");
StackExchange.ready(function() {
var channelOptions = {
tags: "".split(" "),
id: "1"
};
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function() {
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled) {
StackExchange.using("snippets", function() {
createEditor();
});
}
else {
createEditor();
}
});
function createEditor() {
StackExchange.prepareEditor({
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader: {
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
},
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
});
}
});
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53303489%2fbootsrap-cards-scale-to-content-to-fit-card-body%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
1 Answer
1
active
oldest
votes
1 Answer
1
active
oldest
votes
active
oldest
votes
active
oldest
votes
I suggest you to use matchHeight:
First, put this in footer
<script type="text/javascript" src="https://cdnjs.cloudflare.com/ajax/libs/jquery.matchHeight/0.7.2/jquery.matchHeight-min.js"></script>
Second, put this in footer (next to code above)
$(".card").matchHeight();
It'll work, upvote and accept my answer if it works, or let me know that it doesn't work
Here is the demo:
https://codepen.io/Lincox/pen/RqpERa
Thanks for the answer. and if it works, don't worry about it ;)
– Guy Louzon
Nov 14 '18 at 16:28
You're welcome. Don't forget to upvote and accept my answer as a right answer. Thank you.
– Luu Hoang Bac
Nov 14 '18 at 16:32
That works ! any way I can have the card to be set with a max size, so that the content would shrink accordingly ?
– Guy Louzon
Nov 15 '18 at 6:48
1
I'm not sure that I understand your idea, but in your case above, you just simply putwidth: 500px
in the class.frontside
and.backside
like this:.frontside, .backside{ width: 500px; }
you can change the number 500px
– Luu Hoang Bac
Nov 15 '18 at 15:27
add a comment |
I suggest you to use matchHeight:
First, put this in footer
<script type="text/javascript" src="https://cdnjs.cloudflare.com/ajax/libs/jquery.matchHeight/0.7.2/jquery.matchHeight-min.js"></script>
Second, put this in footer (next to code above)
$(".card").matchHeight();
It'll work, upvote and accept my answer if it works, or let me know that it doesn't work
Here is the demo:
https://codepen.io/Lincox/pen/RqpERa
Thanks for the answer. and if it works, don't worry about it ;)
– Guy Louzon
Nov 14 '18 at 16:28
You're welcome. Don't forget to upvote and accept my answer as a right answer. Thank you.
– Luu Hoang Bac
Nov 14 '18 at 16:32
That works ! any way I can have the card to be set with a max size, so that the content would shrink accordingly ?
– Guy Louzon
Nov 15 '18 at 6:48
1
I'm not sure that I understand your idea, but in your case above, you just simply putwidth: 500px
in the class.frontside
and.backside
like this:.frontside, .backside{ width: 500px; }
you can change the number 500px
– Luu Hoang Bac
Nov 15 '18 at 15:27
add a comment |
I suggest you to use matchHeight:
First, put this in footer
<script type="text/javascript" src="https://cdnjs.cloudflare.com/ajax/libs/jquery.matchHeight/0.7.2/jquery.matchHeight-min.js"></script>
Second, put this in footer (next to code above)
$(".card").matchHeight();
It'll work, upvote and accept my answer if it works, or let me know that it doesn't work
Here is the demo:
https://codepen.io/Lincox/pen/RqpERa
I suggest you to use matchHeight:
First, put this in footer
<script type="text/javascript" src="https://cdnjs.cloudflare.com/ajax/libs/jquery.matchHeight/0.7.2/jquery.matchHeight-min.js"></script>
Second, put this in footer (next to code above)
$(".card").matchHeight();
It'll work, upvote and accept my answer if it works, or let me know that it doesn't work
Here is the demo:
https://codepen.io/Lincox/pen/RqpERa
answered Nov 14 '18 at 16:21
Luu Hoang BacLuu Hoang Bac
12910
12910
Thanks for the answer. and if it works, don't worry about it ;)
– Guy Louzon
Nov 14 '18 at 16:28
You're welcome. Don't forget to upvote and accept my answer as a right answer. Thank you.
– Luu Hoang Bac
Nov 14 '18 at 16:32
That works ! any way I can have the card to be set with a max size, so that the content would shrink accordingly ?
– Guy Louzon
Nov 15 '18 at 6:48
1
I'm not sure that I understand your idea, but in your case above, you just simply putwidth: 500px
in the class.frontside
and.backside
like this:.frontside, .backside{ width: 500px; }
you can change the number 500px
– Luu Hoang Bac
Nov 15 '18 at 15:27
add a comment |
Thanks for the answer. and if it works, don't worry about it ;)
– Guy Louzon
Nov 14 '18 at 16:28
You're welcome. Don't forget to upvote and accept my answer as a right answer. Thank you.
– Luu Hoang Bac
Nov 14 '18 at 16:32
That works ! any way I can have the card to be set with a max size, so that the content would shrink accordingly ?
– Guy Louzon
Nov 15 '18 at 6:48
1
I'm not sure that I understand your idea, but in your case above, you just simply putwidth: 500px
in the class.frontside
and.backside
like this:.frontside, .backside{ width: 500px; }
you can change the number 500px
– Luu Hoang Bac
Nov 15 '18 at 15:27
Thanks for the answer. and if it works, don't worry about it ;)
– Guy Louzon
Nov 14 '18 at 16:28
Thanks for the answer. and if it works, don't worry about it ;)
– Guy Louzon
Nov 14 '18 at 16:28
You're welcome. Don't forget to upvote and accept my answer as a right answer. Thank you.
– Luu Hoang Bac
Nov 14 '18 at 16:32
You're welcome. Don't forget to upvote and accept my answer as a right answer. Thank you.
– Luu Hoang Bac
Nov 14 '18 at 16:32
That works ! any way I can have the card to be set with a max size, so that the content would shrink accordingly ?
– Guy Louzon
Nov 15 '18 at 6:48
That works ! any way I can have the card to be set with a max size, so that the content would shrink accordingly ?
– Guy Louzon
Nov 15 '18 at 6:48
1
1
I'm not sure that I understand your idea, but in your case above, you just simply put
width: 500px
in the class .frontside
and .backside
like this: .frontside, .backside{ width: 500px; }
you can change the number 500px– Luu Hoang Bac
Nov 15 '18 at 15:27
I'm not sure that I understand your idea, but in your case above, you just simply put
width: 500px
in the class .frontside
and .backside
like this: .frontside, .backside{ width: 500px; }
you can change the number 500px– Luu Hoang Bac
Nov 15 '18 at 15:27
add a comment |
Thanks for contributing an answer to Stack Overflow!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53303489%2fbootsrap-cards-scale-to-content-to-fit-card-body%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown