CSS transform rotate works strangely on Chrome - html

When I check on Firefox, it works great. But when using Chrome 37, the transform rotate doesn't work well.
Can anyone can help me explain what is happening here?
Here my code:
Codepen: http://codepen.io/thehung1724/full/BxKvD/
HTML
<div id="team">
<div class="content-section">
<div class="container">
<div class="row">
<div class="col-lg-4 col-md-4 col-sm-4">
<div class="team-box">
<img src="http://content.screencast.com/users/HungSzczesny/folders/Default/media/fd5d4869-0a99-4157-9494-41ccea7ca71d/team-1.jpg" alt="">
<div class="ImageOverlay"></div>
</div> <!-- end team-box -->
</div>
<div class="col-lg-4 col-md-4 col-sm-4">
<div class="team-box">
<img src="http://content.screencast.com/users/HungSzczesny/folders/Default/media/0e07023a-77e8-4187-aec3-64e5498d2153/team-2.jpg" alt="">
<div class="ImageOverlay"></div>
</div> <!-- end team-box -->
</div>
<div class="col-lg-4 col-md-4 col-sm-4">
<div class="team-box">
<img src="http://content.screencast.com/users/HungSzczesny/folders/Default/media/389660c7-1e6b-45f5-840c-100822f704f4/team-3.jpg" alt="">
<div class="ImageOverlay"></div>
</div> <!-- end team-box -->
</div>
</div> <!-- end row -->
</div> <!-- end container -->
</div> <!-- end content-section -->
</div> <!-- end team -->
CSS (LESS)
.team-box{
margin: 0 auto;
width: 254px;
height: 254px;
display: block;
overflow: hidden;
position: relative;
.border-radius(50%);
.ImageOverlay{
background: none repeat scroll 0 0 rgba(0, 0, 0, 0.5);
height: 254px;
width: 254px;
display: inline-block;
top: 0;
opacity: 0;
position: absolute;
left: 0;
-webkit-transform: rotate(-180deg) scale(0);
-moz-transform: rotate(-180deg) scale(0);
-ms-transform: rotate(-180deg) scale(0);
-o-transform: rotate(-180deg) scale(0);
transform: rotate(-180deg) scale(0);
.transition(~"all 0.3s ease 0s");
}
&:hover{
.ImageOverlay{
.transform(rotate(0) scale(1));
opacity: 1;
}
}
}

You've changed your demo now, but as pointed out elsewhere, you need this:
.team-box {
z-index:1;
}

Related

How can I add keyfram3 to move from right to left

I have card items in html.
As you see there are 8 card items. What I am trying to achieve is I want to add a keyframe to move that from right to left and when I hover over one of the card items, I want it to stop. Since I want it continuously like a chain turn over and over, I couldn't figure out how to do it. Can I achieve this only with css?
.card {
list-style: none;
position: relative;
filter: brightness(0.9) saturate(0);
}
.card:before {
content: "";
display: block;
padding-bottom: 150%;
width: 100%;
}
.card-background {
background-size: cover;
background-position: center;
border-radius: 24px;
bottom: 0;
filter: brightness(0.75) saturate(1.2) contrast(0.85);
left: 0;
position: absolute;
right: 0;
top: 0;
transform-origin: center;
trsnsform: scale(1) translateZ(0);
transition: filter 200ms linear, transform 200ms linear;
}
.card:hover {
filter: unset;
}
.card:hover .card-background {
transform: scale(1.05) translateZ(0);
cursor: pointer;
}
<div class="row">
<div class="col-md-2">
<div class="card">
<div class="card-background" style="background-image: url(https://images.unsplash.com/photo-1557177324-56c542165309?ixlib=rb-1.2.1&auto=format&fit=crop&w=1950&q=80)">
</div>
</div>
</div>
<div class="col-md-2">
<div class="card">
<div class="card-background" style="background-image: url(https://images.unsplash.com/photo-1557177324-56c542165309?ixlib=rb-1.2.1&auto=format&fit=crop&w=1950&q=80)">
</div>
</div>
</div>
<div class="col-md-2">
<div class="card">
<div class="card-background" style="background-image: url(https://images.unsplash.com/photo-1557177324-56c542165309?ixlib=rb-1.2.1&auto=format&fit=crop&w=1950&q=80)">
</div>
</div>
</div>
<div class="col-md-2">
<div class="card">
<div class="card-background" style="background-image: url(https://images.unsplash.com/photo-1557187666-4fd70cf76254?ixlib=rb-1.2.1&ixid=eyJhcHBfaWQiOjEyMDd9&auto=format&fit=crop&w=800&q=60)">
</div>
</div>
</div>
<div class="col-md-2">
<div class="card">
<div class="card-background" style="background-image: url(https://images.unsplash.com/photo-1556680262-9990363a3e6d?ixlib=rb-1.2.1&ixid=eyJhcHBfaWQiOjEyMDd9&auto=format&fit=crop&w=800&q=60)">
</div>
</div>
</div>
<div class="col-md-2">
<div class="card">
<div class="card-background" style="background-image: url(https://images.unsplash.com/photo-1557004396-66e4174d7bf6?ixlib=rb-1.2.1&ixid=eyJhcHBfaWQiOjEyMDd9&auto=format&fit=crop&w=800&q=60)">
</div>
</div>
</div>
<div class="col-md-2">
<div class="card">
<div class="card-background" style="background-image: url(https://images.unsplash.com/photo-1556680262-9990363a3e6d?ixlib=rb-1.2.1&ixid=eyJhcHBfaWQiOjEyMDd9&auto=format&fit=crop&w=800&q=60)">
</div>
</div>
</div>
<div class="col-md-2">
<div class="card">
<div class="card-background" style="background-image: url(https://images.unsplash.com/photo-1557004396-66e4174d7bf6?ixlib=rb-1.2.1&ixid=eyJhcHBfaWQiOjEyMDd9&auto=format&fit=crop&w=800&q=60)">
</div>
</div>
</div>
</div>
But I didnt add my keyframe because I dont know how can I make it. Literally, I am trying to achieve full turn, like when it goes out from the window something else should come infinitely.
Use this in your css file.
.card {
list-style: none;
position: relative;
filter: brightness(0.9) saturate(0);
width: 10%;
animation: lefttoright 5s linear 2s infinite alternate; //name duration timing-function delay count direction
}
#keyframes lefttoright {
0%{
left: 0;
}
50%{
left: 50%;
}
100%{
left: 0;
}
}
.card:hover {
filter: unset;
animation-play-state: paused; //stop animation when hover on each item
}
It's done.

How to positioning the back of a Bootstrap flip card on the same position as the front?

I need some help with a bootstrap flip card.
I try to create a Bootstrap flip card, but I cannot figure out how to get the back side on the same position as the front side. Can somebody help me please?
.card-flip>div {
backface-visibility: hidden;
transition: transform 300ms;
transition-timing-function: linear;
width: 100%;
height: 100%;
/* margin: 0; */
/* display: flex; */
}
.card-front {
transform: rotateY(0deg);
}
.card-back {
transform: rotateY(180deg);
position: relative;
top: 0;
}
.card-flip:hover .card-front {
transform: rotateY(-180deg);
}
.card-flip:hover .card-back {
transform: rotateY(0deg);
}
<link href="https://cdnjs.cloudflare.com/ajax/libs/twitter-bootstrap/4.4.1/css/bootstrap.min.css" rel="stylesheet">
<!-- Material Design Bootstrap -->
<link href="https://cdnjs.cloudflare.com/ajax/libs/mdbootstrap/4.11.0/css/mdb.min.css" rel="stylesheet">
<header>
<nav class="navbar navbar-expand-md">
<div class="navbar-brand">
<strong>Header</strong>
</div>
</nav>
</header>
<main style="min-height: calc(100vh - 111px); display: inline-block; width: 100%;">
<div class="card-flip h-100">
<div class="container my-5 z-depth-3 p-3 card-front">
<h3 class="text-center display-4 mb-4">Front</h3>
</div>
<div class="container my-5 z-depth-3 p-3 card-back">
<h3 class="text-center display-4 mb-4">Back</h3>
</div>
</div>
</main>
<footer class="page-footer text-center font-small black-text">
<div class="py-1">
Footer
</div>
</footer>
Change position: relative to position: absolute for card-back so it will stick on top of card-front.
.card-flip {
display: flex;
flex-direction: column;
align-items: center;
position: relative;
}
.card-flip>div {
backface-visibility: hidden;
transition: transform 300ms;
transition-timing-function: linear;
/* margin: 0; */
/* display: flex; */
}
.card-front {
transform: rotateY(0deg);
}
.card-back {
transform: rotateY(180deg);
position: absolute;
top: 0;
}
.card-flip:hover .card-front {
transform: rotateY(-180deg);
}
.card-flip:hover .card-back {
transform: rotateY(0deg);
}
<link href="https://cdnjs.cloudflare.com/ajax/libs/twitter-bootstrap/4.4.1/css/bootstrap.min.css" rel="stylesheet">
<!-- Material Design Bootstrap -->
<link href="https://cdnjs.cloudflare.com/ajax/libs/mdbootstrap/4.11.0/css/mdb.min.css" rel="stylesheet">
<header>
<nav class="navbar navbar-expand-md">
<div class="navbar-brand">
<strong>Header</strong>
</div>
</nav>
</header>
<main style="min-height: calc(100vh - 111px); display: inline-block; width: 100%;">
<div class="card-flip h-100">
<div class="container my-5 z-depth-3 p-3 card-front">
<h3 class="text-center display-4 mb-4">Front</h3>
</div>
<div class="container my-5 z-depth-3 p-3 card-back">
<h3 class="text-center display-4 mb-4">Back</h3>
</div>
</div>
</main>
<footer class="page-footer text-center font-small black-text">
<div class="py-1">
Footer
</div>
</footer>
Edit I've added flex-box properties to card-flip. So it'll set the position at the center.

image hover effect all at the same time

I have an all css and bootstrap hover effect, the overlay tags are all encased in a div class but all of them hover at the same time. all three have separate bootstrap grids and the effect even extends to the empty space in between the photos. any help would be appreciated thank you.
HTML:
<div class="container">
<div class="row">
<div class="col-md-12 text-align-center">
<h2 class="bold_font">BROWSE OUR CARDS</h2><br>
</div>
<div class="col-md-4 col-xs-12">
<a href="cards/list.php?tn=beauty">
<img class="img-responsive" src="img/_stock_mwc_beauty.jpg">
<div class="overlay">
<div class="overlay-content">
<img src="img/icon-beauty-white.png" class="img-responsive center-block">
<div class="spacer overlay-text">BEAUTY</div>
</div>
</div>
</a>
</div>
<div class="col-md-4 col-xs-12">
<a href="cards/list.php?tn=health">
<img class="img-responsive" src="img/_stock_mwc_health.jpg">
<div class="overlay">
<div class="overlay-content">
<img src="img/icon-health-white.png" class="img-responsive center-block">
<div class="spacer overlay-text">HEALTH</div>
</div>
</div>
</a>
</div>
<div class="col-md-4 col-xs-12">
<a href="cards/list.php?tn=wellness">
<img class="img-responsive" src="img/_stock_mwc_wellness.jpg">
<div class="overlay">
<div class="overlay-content">
<img src="img/icon-wellness-white.png" class="img-responsive center-block">
<div class="spacer overlay-text">WELLNESS</div>
</div>
</div>
</a>
</div>
</div>
</div>
CSS:
.overlay {
position: absolute;
top: 0;
bottom: 0;
left: 0;
right: 0;
height: 100%;
width: 100%;
opacity: 0;
transition: .5s ease;
background-color: #f08300;
}
.container:hover .overlay {
opacity: 1;
}
.overlay-content {
color: white;
font-size: 20px;
position: absolute;
top: 50%;
left: 50%;
-webkit-transform: translate(-50%, -50%);
-ms-transform: translate(-50%, -50%);
transform: translate(-50%, -50%);
text-align: center;
}
.spacer {
margin: 20px 0px 20px 0px;
}
here is my js fiddle for more info, i just added random placeholder images: http://jsfiddle.net/cnkgqhdw/1/
Don't do the hover on the container, do it on the columns! Just change .container:hover to .col-md-4:hover.
To keep the space correct, you can use bootstrap own spacing system. In your case, you can put a default margin around by adding the class mx-3 to the overlay element.
.overlay {
position: absolute;
top: 0;
bottom: 0;
left: 0;
right: 0;
opacity: 0;
transition: .5s ease;
background-color: #f3a64c;
}
.col-md-4:hover .overlay {
opacity: 1;
}
.overlay-content {
color: white;
font-size: 30px;
position: absolute;
top: 50%;
left: 50%;
-webkit-transform: translate(-50%, -50%);
-ms-transform: translate(-50%, -50%);
transform: translate(-50%, -50%);
text-align: center;
}
.exact-center {
text-align: center;
vertical-align: middle;
}
.spacer {
margin: 20px 0px 20px 0px;
}
<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="container">
<div class="row">
<div class="col-md-12 text-align-center">
<h2 class="bold_font">BROWSE OUR CARDS</h2><br>
</div>
<div class="col-md-4 col-xs-12">
<img class="img-responsive" src="img/_stock_mwc_beauty.jpg">
<div class="overlay mx-3">
<div class="overlay-content">
<img src="img/icon-beauty-white.png" class="img-responsive center-block">
<div class="spacer overlay-text">BEAUTY</div>
</div>
</div>
</div>
<div class="col-md-4 col-xs-12">
<img class="img-responsive" src="img/_stock_mwc_health.jpg">
<div class="overlay mx-3">
<div class="overlay-content">
<img src="img/icon-health-white.png" class="img-responsive center-block">
<div class="spacer overlay-text">HEALTH</div>
</div>
</div>
</div>
<div class="col-md-4 col-xs-12">
<img class="img-responsive" src="img/_stock_mwc_wellness.jpg">
<div class="overlay mx-3">
<div class="overlay-content px-3">
<img src="img/icon-wellness-white.png" class="img-responsive center-block">
<div class="spacer overlay-text">WELLNESS</div>
</div>
</div>
</div>
</div>
</div>
You have it setup to :hover on the .container element, which is the entire row. Need to add a class to your card and do .card:hover
You are hovering on the whole container. So that's why everything gets the hover state.
You should add a class to the
<a class="item" href="">
and hover that:
.item:hover {
//styling here
}

Bootstrap 4 with rotating cards

I am creating my own card using Bootstrap v4 (with only rows and columns). The problem is when I try to put the two sides of the card on top of each other. I use position: absolute; They disappear completely
.thecard {
perspective: 150rem;
-moz-perspective: 150rem;
position: relative;
}
.thecard__side {
background-color: orangered;
color: #fff;
font-size: 2rem;
height: 50rem;
transition: all .8s;
position: absolute;
top: 0;
left: 0;
width: 100%;
backface-visibility: hidden;
}
.thecard__side--front {
background-color: orangered;
}
.thecard__side--back {
background-color: green;
-webkit-transform: rotateY(180deg);
transform: rotateY(180deg);
}
.thecard:hover .thecard__side--front {
-webkit-transform: rotateY(180deg);
transform: rotateY(180deg);
}
.thecard:hover .thecard__side--back {
-webkit-transform: rotateY(0);
transform: rotateY(0);
}
<div class="row mt-5">
<div class="mt-5 mt-lg-0 col-md-6 col-lg-4">
<div class="thecard">
<div class="thecard__side thecard__side--front">
Front
</div>
<div class="thecard__side thecard__side--back">
Back
</div>
</div>
</div>
<div class="mt-5 mt-lg-0 col-md-6 col-lg-4">
<div class="thecard">
<div class="thecard__side thecard__side--front">
Front
</div>
<div class="thecard__side thecard__side--back">
Back
</div>
</div>
</div>
<div class=" offset-md-3 mt-5 mt-lg-0 offset-lg-0 col-md-6 col-lg-4">
<div class="thecard">
<div class="thecard__side thecard__side--front">
Front
</div>
<div class="thecard__side thecard__side--back">
Back
</div>
</div>
</div>
</div>
any solution guys?
After multiple testing, the same height on both these classes fixed the issue for me:
.thecard {
perspective: 150rem;
-moz-perspective: 150rem;
position: relative;
height: 50rem;
}
.thecard__side {
background-color: orangered;
color: #fff;
font-size: 2rem;
height: 50rem;
transition: all .8s;
position: absolute;
top: 0;
left: 0;
width: 100%;
backface-visibility: hidden;
}
You Can Try This Code
.thecard {
perspective: 150rem;
-moz-perspective: 150rem;
position: relative;
height: 350px;
}
.thecard__side {
background-color: orangered;
color: #fff;
font-size: 2rem;
height: 50rem;
transition: all .8s;
position: absolute;
top: 0;
left: 0;
width: 100%;
backface-visibility: hidden;
}
.thecard__side--front {
background-color: orangered;
}
.thecard__side--back {
background-color: green;
-webkit-transform: rotateY(180deg);
transform: rotateY(180deg);
}
.thecard:hover .thecard__side--front {
-webkit-transform: rotateY(180deg);
transform: rotateY(180deg);
}
.thecard:hover .thecard__side--back {
-webkit-transform: rotateY(0);
transform: rotateY(0);
}
<div class="row mt-5">
<div class="mt-5 mt-lg-0 col-md-6 col-lg-4">
<div class="thecard">
<div class="thecard__side thecard__side--front">
Front
</div>
<div class="thecard__side thecard__side--back">
Back
</div>
</div>
</div>
<div class="mt-5 mt-lg-0 col-md-6 col-lg-4">
<div class="thecard">
<div class="thecard__side thecard__side--front">
Front
</div>
<div class="thecard__side thecard__side--back">
Back
</div>
</div>
</div>
<div class=" offset-md-3 mt-5 mt-lg-0 offset-lg-0 col-md-6 col-lg-4">
<div class="thecard">
<div class="thecard__side thecard__side--front">
Front
</div>
<div class="thecard__side thecard__side--back">
Back
</div>
</div>
</div>
</div>

Hover-Effect disappears, when hovering over Text

the topic is saying it - my problem is following:
I want to have a color overlay when I hover over my picture
the text on image should be visible before and after hovering without any changes
Issue: when I hover over the text, the color hover overlay disappears (it's just visible when I move around in the Div without moving it over the text)
I tried some other solutions, like pseudo classes, but I didn't make it work...thank ya'll!
#import url('https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css');
.text_z{
color: white;
font-size: 20px;
position: absolute;
top: 50%;
left: 50%;
transform: translate(-50%, -50%);
-ms-transform: translate(-50%, -50%);
z-index: 999;
}
.image_box_one img {
width: 100%;
display: block;
height: auto;
}
.image_box_one {
background: rgba(29, 106, 154, 0.72);
padding:0px;
margin:0px;
}
.image_box_one img:hover {
opacity: 0.5;
}
<div class="container">
<div class="row">
<div class="col-lg-4">
<div class="image_box_one">
<img src="http://placehold.it/1332x1017" />
<div class="text_z">Hover over Me <br>Overlay Disappears</div>
</div>
</div>
<div class="col-lg-4">
<div class="image_box_one">
<img src="http://placehold.it/1332x1017" />
<div class="text_z">Hover over Me <br>Overlay Disappears</div>
</div>
</div>
<div class="col-lg-4">
<div class="image_box_one">
<img src="http://placehold.it/1332x1017" />
<div class="text_z">Hover over Me <br>Overlay Disappears</div>
</div>
</div>
</div>
</div>
When you hover over the text, you're no longer hovering the img. Change your selector to .image_box_one:hover img so that when you hover over anything in an .image_box_one, it will apply styles to the img
#import url('https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css');
.text_z{
color: white;
font-size: 20px;
position: absolute;
top: 50%;
left: 50%;
transform: translate(-50%, -50%);
-ms-transform: translate(-50%, -50%);
z-index: 999;
}
.image_box_one img {
width: 100%;
display: block;
height: auto;
}
.image_box_one {
background: rgba(29, 106, 154, 0.72);
padding:0px;
margin:0px;
}
.image_box_one:hover img {
opacity: 0.5;
}
<div class="container">
<div class="row">
<div class="col-lg-4">
<div class="image_box_one">
<img src="http://placehold.it/1332x1017" />
<div class="text_z">Hover over Me <br>Overlay Disappears</div>
</div>
</div>
<div class="col-lg-4">
<div class="image_box_one">
<img src="http://placehold.it/1332x1017" />
<div class="text_z">Hover over Me <br>Overlay Disappears</div>
</div>
</div>
<div class="col-lg-4">
<div class="image_box_one">
<img src="http://placehold.it/1332x1017" />
<div class="text_z">Hover over Me <br>Overlay Disappears</div>
</div>
</div>
</div>
</div>