I have 4 images on my site and display 2 vertically with 2 horizontal images next to these in a grid.
The problem I'm having is that the images line up correctly when the page is desktop size but when it is scaled down to mobile the images will scale differently and look out of alignment
As you can see the vertical images on the left don't scale to fit the container height, is there a way to stretch these images to match the container height?
How can I get the images to stay aligned at all times?
* {
box-sizing: border-box;
}
.home-promo-wrap {
display: flex;
flex-wrap: wrap;
}
.home-promo-cell {
display: flex;
flex: 0 0 50%;
}
.gridA {
display:flex;
flex-wrap: wrap;
flex: 1 1 auto;
}
.gridB {
display:flex;
flex-wrap: wrap;
}
.cell {
display: flex;
flex: 0 0 50%;
padding: 10px;
}
.gridB .cell:nth-child(1) {
flex: 0 0 100%;
}
.gridB .cell:nth-child(2) {
flex: 0 0 100%;
}
.text-vertical {
position: absolute;
top: 0;
left: 0;
right: 0;
color: #000;
z-index: 1;
text-align: center;
background: rgba( 255,255,255,0.6);
padding: 20px;
}
.inner-cell-vertical:hover .text-vertical {
background: rgba(255,255,255,0);
transition: background 0.8s ease;
}
.inner-cell-vertical {
position: relative;
overflow: hidden;
background: #ff00ff;
}
.inner-cell-vertical img {
width: 100%;
height: auto;
display: block;
overflow:hidden;
}
.inner-cell-vertical::after {
content:'\A';
position:absolute;
width:100%; height:100%;
top:0; left:0;
background:rgba(255,255,255,.6);
animation-name: fadeFromtop;
-webkit-animation-name: fadeFromtop;
animation-duration: 300ms;
-webkit-animation-duration: 300ms;
animation-timing-function: ease-out;
-webkit-animation-timing-function: ease-out;
animation-fill-mode: forwards;
-webkit-animation-fill-mode: forwards;
overflow: hidden;
}
.inner-cell-vertical:hover .text {
bottom: 50%;
transform: translateY(50%);
-webkit-transform: translateY(50%);
-moz-transform: translateY(50%);
-o-transform: translateY(50%);
}
.text {
position: absolute;
top:0;
left:0;
padding-left: 35px;
padding-bottom: 17px;
transition: all 0.5s ease;
height: 100%;
}
a {
display: flex;
}
a:hover .inner-cell-vertical:after {
animation-name: fadeFromBottom;
-webkit-animation-name: fadeFromBottom;
animation-duration: 300ms;
-webkit-animation-duration: 300ms;
animation-timing-function: ease-in;
-webkit-animation-timing-function: ease-in;
animation-fill-mode: forwards;
opacity:1;
overflow: hidden;
}
#keyframes fadeFromBottom {
0%{
opacity:0;
-webkit-transform: translateY(100%);
-moz-transform: translateY(100%);
-ms-transform: translateY(100%);
-o-transform: translateY(100%);
transform: translateY(100%);
}
100%{
opacity: 1;
-webkit-transform: translateY(0px);
-moz-transform: translateY(0px);
-ms-transform: translateY(0px);
-o-transform: translateY(0px);
transform: translateY(0px);
display: block;
}
}
#keyframes fadeFromtop {
0%{
opacity:1;
-webkit-transform: translateY(0px);
-moz-transform: translateY(0px);
-ms-transform: translateY(0px);
-o-transform: translateY(0px);
transform: translateY(0px);
}
100%{
opacity: 0;
-webkit-transform: translateY(100%);
-moz-transform: translateY(100%);
-ms-transform: translateY(400%);
-o-transform: translateY(100%);
transform: translateY(100%);
}
}
<div class="home-promo-wrap">
<div class="home-promo-cell">
<div class="gridA">
<div class="cell">
<a>
<div class="inner-cell-vertical">
<div class="text-vertical">
<h2>
</h2>
<p class="text-desc">
</p>
</div><img class="img-responsive" src="https://plissee-jalousien-rollos.de/media/wysiwyg/categories_1_1.jpg" alt="" /></div>
</a>
</div>
<div class="cell">
<a>
<div class="inner-cell-vertical">
<div class="text-vertical">
<h2>
</h2>
<p class="text-desc">
</p>
</div>
<img class="img-responsive" src="https://plissee-jalousien-rollos.de/media/wysiwyg/categories_1_1.jpg" alt="" />
</div>
</a>
</div>
</div>
</div>
<div class="home-promo-cell">
<div class="gridB">
<div class="cell">
<a>
<div class="inner-cell-vertical">
<div class="text-vertical">
<h2>
</h2>
<p class="text-desc">
</p>
</div>
<img class="img-responsive" src="https://plissee-jalousien-rollos.de/media/wysiwyg/categories_1_3.jpg" alt="" />
</div>
</a>
</div>
<div class="cell">
<a>
<div class="inner-cell-vertical">
<div class="text-vertical">
<h2>
</h2>
<p class="text-desc">
</p>
</div>
<img class="img-responsive" src="https://plissee-jalousien-rollos.de/media/wysiwyg/categories_1_4.jpg" alt="" />
</div>
</a>
</div>
</div>
</div>
</div>
If to keep the img you could use object-fit.
Note, object-fit has limits when it comes to browser support: https://caniuse.com/#feat=object-fit
If you need better browser support, here is a sample using background-image: jsfiddle demo.
The main with this version is to set a height and nested flex containers.
Stack snippet
* {
box-sizing: border-box;
}
.home-promo-wrap {
display: flex;
flex-wrap: wrap;
}
.home-promo-cell {
display: flex;
flex: 0 0 50%;
}
.gridA {
display:flex;
flex-wrap: wrap;
flex: 1 1 auto;
}
.gridB {
display:flex;
flex-wrap: wrap;
}
.cell {
display: flex;
flex: 0 0 50%;
padding: 10px;
}
.gridB .cell:nth-child(1) {
flex: 0 0 100%;
}
.gridB .cell:nth-child(2) {
flex: 0 0 100%;
}
.text-vertical {
position: absolute;
top: 0;
left: 0;
right: 0;
color: #000;
z-index: 1;
text-align: center;
background: rgba( 255,255,255,0.6);
padding: 20px;
}
.inner-cell-vertical:hover .text-vertical {
background: rgba(255,255,255,0);
transition: background 0.8s ease;
}
.inner-cell-vertical {
position: relative;
overflow: hidden;
background: #ff00ff;
}
.inner-cell-vertical img {
width: 100%;
height: 100%; /* changed */
display: block;
overflow:hidden;
object-fit: cover; /* added */
}
.inner-cell-vertical::after {
content:'\A';
position:absolute;
width:100%; height:100%;
top:0; left:0;
background:rgba(255,255,255,.6);
animation-name: fadeFromtop;
-webkit-animation-name: fadeFromtop;
animation-duration: 300ms;
-webkit-animation-duration: 300ms;
animation-timing-function: ease-out;
-webkit-animation-timing-function: ease-out;
animation-fill-mode: forwards;
-webkit-animation-fill-mode: forwards;
overflow: hidden;
}
.inner-cell-vertical:hover .text {
bottom: 50%;
transform: translateY(50%);
-webkit-transform: translateY(50%);
-moz-transform: translateY(50%);
-o-transform: translateY(50%);
}
.text {
position: absolute;
top:0;
left:0;
padding-left: 35px;
padding-bottom: 17px;
transition: all 0.5s ease;
height: 100%;
}
a {
display: flex;
}
a:hover .inner-cell-vertical:after {
animation-name: fadeFromBottom;
-webkit-animation-name: fadeFromBottom;
animation-duration: 300ms;
-webkit-animation-duration: 300ms;
animation-timing-function: ease-in;
-webkit-animation-timing-function: ease-in;
animation-fill-mode: forwards;
opacity:1;
overflow: hidden;
}
#keyframes fadeFromBottom {
0%{
opacity:0;
-webkit-transform: translateY(100%);
-moz-transform: translateY(100%);
-ms-transform: translateY(100%);
-o-transform: translateY(100%);
transform: translateY(100%);
}
100%{
opacity: 1;
-webkit-transform: translateY(0px);
-moz-transform: translateY(0px);
-ms-transform: translateY(0px);
-o-transform: translateY(0px);
transform: translateY(0px);
display: block;
}
}
#keyframes fadeFromtop {
0%{
opacity:1;
-webkit-transform: translateY(0px);
-moz-transform: translateY(0px);
-ms-transform: translateY(0px);
-o-transform: translateY(0px);
transform: translateY(0px);
}
100%{
opacity: 0;
-webkit-transform: translateY(100%);
-moz-transform: translateY(100%);
-ms-transform: translateY(400%);
-o-transform: translateY(100%);
transform: translateY(100%);
}
}
<div class="home-promo-wrap">
<div class="home-promo-cell">
<div class="gridA">
<div class="cell">
<a>
<div class="inner-cell-vertical">
<div class="text-vertical">
<h2>
</h2>
<p class="text-desc">
</p>
</div><img class="img-responsive" src="https://plissee-jalousien-rollos.de/media/wysiwyg/categories_1_1.jpg" alt="" /></div>
</a>
</div>
<div class="cell">
<a>
<div class="inner-cell-vertical">
<div class="text-vertical">
<h2>
</h2>
<p class="text-desc">
</p>
</div>
<img class="img-responsive" src="https://plissee-jalousien-rollos.de/media/wysiwyg/categories_1_1.jpg" alt="" />
</div>
</a>
</div>
</div>
</div>
<div class="home-promo-cell">
<div class="gridB">
<div class="cell">
<a>
<div class="inner-cell-vertical">
<div class="text-vertical">
<h2>
</h2>
<p class="text-desc">
</p>
</div>
<img class="img-responsive" src="https://plissee-jalousien-rollos.de/media/wysiwyg/categories_1_3.jpg" alt="" />
</div>
</a>
</div>
<div class="cell">
<a>
<div class="inner-cell-vertical">
<div class="text-vertical">
<h2>
</h2>
<p class="text-desc">
</p>
</div>
<img class="img-responsive" src="https://plissee-jalousien-rollos.de/media/wysiwyg/categories_1_4.jpg" alt="" />
</div>
</a>
</div>
</div>
</div>
</div>
I believe its a one line change at line number 64 in the css.
height: auto; to height: 100%;
.inner-cell-vertical img {
width: 100%;
height: 100%;
display: block;
overflow:hidden;
}
Here is the Pen. Please let me know whether this helps.
Related
I found on CodePen a CSS dropdown menu, a checkbox solution that I liked. I adapted it a little to my needs, excepting that I can't figure out how to hide the close icon when the menu is closed. I know about existing solutions, for example like here, but I can't solve it in my case. Any suggestion?
SOLVED (see below code)
*{
box-sizing: border-box;
margin: 0;
padding: 0;
}
input#toggle-menu{
display: none;
}
#search-toggle {
position: relative;
border-bottom: 4px solid tomato;
perspective: 1000px;
}
.header-inner-wrapper{
display: flex;
flex-direction: row;
justify-content: space-between;
align-items: center;
padding: 10px;
height: 80px;
}
#searchform{
display: flex;
flex-direction: column;
text-align: center;
position: absolute;
top: 84px;
left: 0;
width: 100%;
transform: scaleY(0);
transition: all 0.3s ease;
transform-origin: 50% top;
}
#header-inner-wrapper label{
cursor: pointer;
position: relative;
width: 60px;
height: 30px;
font-size: 0;
margin-top: -18px;
}
input#toggle-menu ~ #searchform {
/* transform: scaleY(0); */
animation: nav-out 1s ease-in-out normal forwards;
}
input#toggle-menu:checked ~ #searchform {
/* transform: scaleY(1); */
animation: nav-in 1s ease-in-out normal forwards;
}
#keyframes nav-in {
0%{
transform-origin: 50% top;
transform: scaleY(0);
}
50%{
transform: scaleY(1.3);
}
80%{
transform: scaleY(0.9);
}
90%{
transform: scaleY(1.05);
}
100%{
transform: scaleY(1);
}
}
#keyframes nav-out {
0%{
transform-origin: left center;
transform: scaleY(1);
}
50%, 60%{
transform: translateX(-10%) rotateY(0);
}
80%{
transform: translateX(100%);
}
99.9%{
transform: translateX(100%) scaleX(1);
}
100%{
transform: translateX(100%) scaleX(0);
opacity: 1;
/* transform: translateX(100%) rotateY(-90deg); */
/* transform: translateX(0%) rotateY(60deg) scaleX(0.2) ;
opacity: 0; */
}
}
input#toggle-menu:checked ~ #header-inner-wrapper #iconsearch {
display: none;
}
input#toggle-menu:not(:checked) ~ #header-inner-wrapper #iconclose {
display: none;
}
<div id="search-toggle" class="float-left">
<input type="checkbox" id="toggle-menu">
<div id="header-inner-wrapper" class="header-inner-wrapper">
<label id="iconsearch" for="toggle-menu">
<svg id="icon icon-search" viewBox="0 0 30 32">
<path class="path1" d="M20.571 14.857q0-3.304-2.348-5.652t-5.652-2.348-5.652 2.348-2.348 5.652 2.348 5.652 5.652 2.348 5.652-2.348 2.348-5.652zM29.714 29.714q0 0.929-0.679 1.607t-1.607 0.679q-0.964 0-1.607-0.679l-6.125-6.107q-3.196 2.214-7.125 2.214-2.554 0-4.884-0.991t-4.018-2.679-2.679-4.018-0.991-4.884 0.991-4.884 2.679-4.018 4.018-2.679 4.884-0.991 4.884 0.991 4.018 2.679 2.679 4.018 0.991 4.884q0 3.929-2.214 7.125l6.125 6.125q0.661 0.661 0.661 1.607z"></path>
</svg>
</label>
<label id="iconclose" for="toggle-menu">
<svg id="icon icon-close" viewBox="0 0 25 32">
<path class="path1" d="M23.179 23.607q0 0.714-0.5 1.214l-2.429 2.429q-0.5 0.5-1.214 0.5t-1.214-0.5l-5.25-5.25-5.25 5.25q-0.5 0.5-1.214 0.5t-1.214-0.5l-2.429-2.429q-0.5-0.5-0.5-1.214t0.5-1.214l5.25-5.25-5.25-5.25q-0.5-0.5-0.5-1.214t0.5-1.214l2.429-2.429q0.5-0.5 1.214-0.5t1.214 0.5l5.25 5.25 5.25-5.25q0.5-0.5 1.214-0.5t1.214 0.5l2.429 2.429q0.5 0.5 0.5 1.214t-0.5 1.214l-5.25 5.25 5.25 5.25q0.5 0.5 0.5 1.214z"></path>
</svg>
</label>
</div>
<div id="searchform">
<form role="search" method="get" class="search-form" action="https://example.com">
<textarea>Here will be a search form</textarea>
</form>
</div>
</div>
few weeks ago I saw a simple, interesting list on codepen but unfortunately it was not resposnive.
I try to make that list responsive on my site for friend.
http://damianobajtek.pl/LandingAdamv2/ (Menu -> services).
I cannot resolve problem with height with media queries. I know that my div is too small (100vh) but what should I do to make it responsive?
Probably the simplest solution could be flexbox but I have a problem to remake that list on flexbox.
Thanks in advance for any advice :)
Changes here:
.second_services .content {
/* float: left; */
width: 100%;
height: 100%;
display: flex;
flex-wrap: wrap;
flex: 1 1 100%;
margin: 0;
padding: 0;
}
.second_services .content li {
/* float: left; */
border-bottom: 1px solid #2c2c2c;
border-left: 1px solid #2c2c2c;
/* width: 33.2%; */
flex: 1 1 calc(100% / 3);
box-sizing: border-box;
height: 25%;
position: relative;
display: flex;
flex-wrap: wrap;
/* Colors Hover */
}
#media (max-width: 1024px) {
.second_services .content li {
/* width: 50%; */
flex-basis: calc(100% / 2);
}
}
/* STYLE FOR SERVICES */
.second_services html,
.second_services body,
.second_services div,
.second_services h1,
.second_services h2,
.second_services h3,
.second_services h4,
.second_services h5,
.second_services h6,
.second_services p,
.second_services ol,
.second_services ul,
.second_services li,
.second_services footer,
.second_services header,
.second_services hgroup,
.second_services menu,
.second_services nav,
{
margin: 0;
padding: 0;
border: 0;
font: inherit;
font-size: 100%;
vertical-align: baseline;
}
.second_services html {
line-height: 1;
}
.second_services ol,
ul {
list-style: none;
}
.second_services table {
border-collapse: collapse;
border-spacing: 0;
}
.second_services caption,
th,
td {
text-align: left;
font-weight: normal;
vertical-align: middle;
}
.second_services q,
.second_services blockquote {
quotes: none;
}
.second_services q:before,
.second_services q:after,
.second_services blockquote:before,
.second_services blockquote:after {
content: "";
content: none;
}
.second_services a img {
border: none;
}
.second_services article,
.second_services aside,
.second_services details,
.second_services figcaption,
.second_services figure,
.second_services footer,
.second_services header,
.second_services hgroup,
.second_services menu,
.second_services nav,
.second_services section,
.second_services summary {
display: block;
}
/**
*
* Animate.css
* From : https://daneden.me/animate/
*
**/
.second_services .animated {
-webkit-animation-fill-mode: both;
-moz-animation-fill-mode: both;
-ms-animation-fill-mode: both;
-o-animation-fill-mode: both;
animation-fill-mode: both;
-webkit-animation-duration: 1s;
-moz-animation-duration: 1s;
-ms-animation-duration: 1s;
-o-animation-duration: 1s;
animation-duration: 1s;
}
.second_services .animated.hinge {
-webkit-animation-duration: 2s;
-moz-animation-duration: 2s;
-ms-animation-duration: 2s;
-o-animation-duration: 2s;
animation-duration: 2s;
}
#-webkit-keyframes bounceIn {
0% {
opacity: 0;
-webkit-transform: scale(0.3);
}
50% {
opacity: 1;
-webkit-transform: scale(1.05);
}
70% {
-webkit-transform: scale(0.9);
}
100% {
-webkit-transform: scale(1);
}
}
#-moz-keyframes bounceIn {
0% {
opacity: 0;
-moz-transform: scale(0.3);
}
50% {
opacity: 1;
-moz-transform: scale(1.05);
}
70% {
-moz-transform: scale(0.9);
}
100% {
-moz-transform: scale(1);
}
}
#-o-keyframes bounceIn {
0% {
opacity: 0;
-o-transform: scale(0.3);
}
50% {
opacity: 1;
-o-transform: scale(1.05);
}
70% {
-o-transform: scale(0.9);
}
100% {
-o-transform: scale(1);
}
}
#keyframes bounceIn {
0% {
opacity: 0;
transform: scale(0.3);
}
50% {
opacity: 1;
transform: scale(1.05);
}
70% {
transform: scale(0.9);
}
100% {
transform: scale(1);
}
}
.bounceIn {
-webkit-animation-name: bounceIn;
-moz-animation-name: bounceIn;
-o-animation-name: bounceIn;
animation-name: bounceIn;
}
#-webkit-keyframes bounceInUp {
0% {
opacity: 0;
-webkit-transform: translateY(2000px);
}
60% {
opacity: 1;
-webkit-transform: translateY(-30px);
}
80% {
-webkit-transform: translateY(10px);
}
100% {
-webkit-transform: translateY(0);
}
}
#-moz-keyframes bounceInUp {
0% {
opacity: 0;
-moz-transform: translateY(2000px);
}
60% {
opacity: 1;
-moz-transform: translateY(-30px);
}
80% {
-moz-transform: translateY(10px);
}
100% {
-moz-transform: translateY(0);
}
}
#-o-keyframes bounceInUp {
0% {
opacity: 0;
-o-transform: translateY(2000px);
}
60% {
opacity: 1;
-o-transform: translateY(-30px);
}
80% {
-o-transform: translateY(10px);
}
100% {
-o-transform: translateY(0);
}
}
#keyframes bounceInUp {
0% {
opacity: 0;
transform: translateY(2000px);
}
60% {
opacity: 1;
transform: translateY(-30px);
}
80% {
transform: translateY(10px);
}
100% {
transform: translateY(0);
}
}
.second_services .bounceInUp {
-webkit-animation-name: bounceInUp;
-moz-animation-name: bounceInUp;
-o-animation-name: bounceInUp;
animation-name: bounceInUp;
}
#-webkit-keyframes bounceInDown {
0% {
opacity: 0;
-webkit-transform: translateY(-2000px);
}
60% {
opacity: 1;
-webkit-transform: translateY(30px);
}
80% {
-webkit-transform: translateY(-10px);
}
100% {
-webkit-transform: translateY(0);
}
}
#-moz-keyframes bounceInDown {
0% {
opacity: 0;
-moz-transform: translateY(-2000px);
}
60% {
opacity: 1;
-moz-transform: translateY(30px);
}
80% {
-moz-transform: translateY(-10px);
}
100% {
-moz-transform: translateY(0);
}
}
#-o-keyframes bounceInDown {
0% {
opacity: 0;
-o-transform: translateY(-2000px);
}
60% {
opacity: 1;
-o-transform: translateY(30px);
}
80% {
-o-transform: translateY(-10px);
}
100% {
-o-transform: translateY(0);
}
}
#keyframes bounceInDown {
0% {
opacity: 0;
transform: translateY(-2000px);
}
60% {
opacity: 1;
transform: translateY(30px);
}
80% {
transform: translateY(-10px);
}
100% {
transform: translateY(0);
}
}
.second_services .bounceInDown {
-webkit-animation-name: bounceInDown;
-moz-animation-name: bounceInDown;
-o-animation-name: bounceInDown;
animation-name: bounceInDown;
}
#-webkit-keyframes bounceInLeft {
0% {
opacity: 0;
-webkit-transform: translateX(-2000px);
}
60% {
opacity: 1;
-webkit-transform: translateX(30px);
}
80% {
-webkit-transform: translateX(-10px);
}
100% {
-webkit-transform: translateX(0);
}
}
#-moz-keyframes bounceInLeft {
0% {
opacity: 0;
-moz-transform: translateX(-2000px);
}
60% {
opacity: 1;
-moz-transform: translateX(30px);
}
80% {
-moz-transform: translateX(-10px);
}
100% {
-moz-transform: translateX(0);
}
}
#-o-keyframes bounceInLeft {
0% {
opacity: 0;
-o-transform: translateX(-2000px);
}
60% {
opacity: 1;
-o-transform: translateX(30px);
}
80% {
-o-transform: translateX(-10px);
}
100% {
-o-transform: translateX(0);
}
}
#keyframes bounceInLeft {
0% {
opacity: 0;
transform: translateX(-2000px);
}
60% {
opacity: 1;
transform: translateX(30px);
}
80% {
transform: translateX(-10px);
}
100% {
transform: translateX(0);
}
}
.second_services .bounceInLeft {
-webkit-animation-name: bounceInLeft;
-moz-animation-name: bounceInLeft;
-o-animation-name: bounceInLeft;
animation-name: bounceInLeft;
}
#-webkit-keyframes bounceInRight {
0% {
opacity: 0;
-webkit-transform: translateX(2000px);
}
60% {
opacity: 1;
-webkit-transform: translateX(-30px);
}
80% {
-webkit-transform: translateX(10px);
}
100% {
-webkit-transform: translateX(0);
}
}
#-moz-keyframes bounceInRight {
0% {
opacity: 0;
-moz-transform: translateX(2000px);
}
60% {
opacity: 1;
-moz-transform: translateX(-30px);
}
80% {
-moz-transform: translateX(10px);
}
100% {
-moz-transform: translateX(0);
}
}
#-o-keyframes bounceInRight {
0% {
opacity: 0;
-o-transform: translateX(2000px);
}
60% {
opacity: 1;
-o-transform: translateX(-30px);
}
80% {
-o-transform: translateX(10px);
}
100% {
-o-transform: translateX(0);
}
}
#keyframes bounceInRight {
0% {
opacity: 0;
transform: translateX(2000px);
}
60% {
opacity: 1;
transform: translateX(-30px);
}
80% {
transform: translateX(10px);
}
100% {
transform: translateX(0);
}
}
.second_services .bounceInRight {
-webkit-animation-name: bounceInRight;
-moz-animation-name: bounceInRight;
-o-animation-name: bounceInRight;
animation-name: bounceInRight;
}
#-webkit-keyframes rotateIn {
0% {
-webkit-transform-origin: center center;
-webkit-transform: rotate(-200deg);
opacity: 0;
}
100% {
-webkit-transform-origin: center center;
-webkit-transform: rotate(0);
opacity: 1;
}
}
#-moz-keyframes rotateIn {
0% {
-moz-transform-origin: center center;
-moz-transform: rotate(-200deg);
opacity: 0;
}
100% {
-moz-transform-origin: center center;
-moz-transform: rotate(0);
opacity: 1;
}
}
#-o-keyframes rotateIn {
0% {
-o-transform-origin: center center;
-o-transform: rotate(-200deg);
opacity: 0;
}
100% {
-o-transform-origin: center center;
-o-transform: rotate(0);
opacity: 1;
}
}
#keyframes rotateIn {
0% {
transform-origin: center center;
transform: rotate(-200deg);
opacity: 0;
}
100% {
transform-origin: center center;
transform: rotate(0);
opacity: 1;
}
}
.rotateIn {
-webkit-animation-name: rotateIn;
-moz-animation-name: rotateIn;
-o-animation-name: rotateIn;
animation-name: rotateIn;
}
#-webkit-keyframes rotateInUpLeft {
0% {
-webkit-transform-origin: left bottom;
-webkit-transform: rotate(90deg);
opacity: 0;
}
100% {
-webkit-transform-origin: left bottom;
-webkit-transform: rotate(0);
opacity: 1;
}
}
#-moz-keyframes rotateInUpLeft {
0% {
-moz-transform-origin: left bottom;
-moz-transform: rotate(90deg);
opacity: 0;
}
100% {
-moz-transform-origin: left bottom;
-moz-transform: rotate(0);
opacity: 1;
}
}
#-o-keyframes rotateInUpLeft {
0% {
-o-transform-origin: left bottom;
-o-transform: rotate(90deg);
opacity: 0;
}
100% {
-o-transform-origin: left bottom;
-o-transform: rotate(0);
opacity: 1;
}
}
#keyframes rotateInUpLeft {
0% {
transform-origin: left bottom;
transform: rotate(90deg);
opacity: 0;
}
100% {
transform-origin: left bottom;
transform: rotate(0);
opacity: 1;
}
}
.second_services .rotateInUpLeft {
-webkit-animation-name: rotateInUpLeft;
-moz-animation-name: rotateInUpLeft;
-o-animation-name: rotateInUpLeft;
animation-name: rotateInUpLeft;
}
#-webkit-keyframes rotateInDownLeft {
0% {
-webkit-transform-origin: left bottom;
-webkit-transform: rotate(-90deg);
opacity: 0;
}
100% {
-webkit-transform-origin: left bottom;
-webkit-transform: rotate(0);
opacity: 1;
}
}
#-moz-keyframes rotateInDownLeft {
0% {
-moz-transform-origin: left bottom;
-moz-transform: rotate(-90deg);
opacity: 0;
}
100% {
-moz-transform-origin: left bottom;
-moz-transform: rotate(0);
opacity: 1;
}
}
#-o-keyframes rotateInDownLeft {
0% {
-o-transform-origin: left bottom;
-o-transform: rotate(-90deg);
opacity: 0;
}
100% {
-o-transform-origin: left bottom;
-o-transform: rotate(0);
opacity: 1;
}
}
#keyframes rotateInDownLeft {
0% {
transform-origin: left bottom;
transform: rotate(-90deg);
opacity: 0;
}
100% {
transform-origin: left bottom;
transform: rotate(0);
opacity: 1;
}
}
.second_services .rotateInDownLeft {
-webkit-animation-name: rotateInDownLeft;
-moz-animation-name: rotateInDownLeft;
-o-animation-name: rotateInDownLeft;
animation-name: rotateInDownLeft;
}
#-webkit-keyframes rotateInUpRight {
0% {
-webkit-transform-origin: right bottom;
-webkit-transform: rotate(-90deg);
opacity: 0;
}
100% {
-webkit-transform-origin: right bottom;
-webkit-transform: rotate(0);
opacity: 1;
}
}
#-moz-keyframes rotateInUpRight {
0% {
-moz-transform-origin: right bottom;
-moz-transform: rotate(-90deg);
opacity: 0;
}
100% {
-moz-transform-origin: right bottom;
-moz-transform: rotate(0);
opacity: 1;
}
}
#-o-keyframes rotateInUpRight {
0% {
-o-transform-origin: right bottom;
-o-transform: rotate(-90deg);
opacity: 0;
}
100% {
-o-transform-origin: right bottom;
-o-transform: rotate(0);
opacity: 1;
}
}
#keyframes rotateInUpRight {
0% {
transform-origin: right bottom;
transform: rotate(-90deg);
opacity: 0;
}
100% {
transform-origin: right bottom;
transform: rotate(0);
opacity: 1;
}
}
.second_services .rotateInUpRight {
-webkit-animation-name: rotateInUpRight;
-moz-animation-name: rotateInUpRight;
-o-animation-name: rotateInUpRight;
animation-name: rotateInUpRight;
}
#-webkit-keyframes rotateInDownRight {
0% {
-webkit-transform-origin: right bottom;
-webkit-transform: rotate(90deg);
opacity: 0;
}
100% {
-webkit-transform-origin: right bottom;
-webkit-transform: rotate(0);
opacity: 1;
}
}
#-moz-keyframes rotateInDownRight {
0% {
-moz-transform-origin: right bottom;
-moz-transform: rotate(90deg);
opacity: 0;
}
100% {
-moz-transform-origin: right bottom;
-moz-transform: rotate(0);
opacity: 1;
}
}
#-o-keyframes rotateInDownRight {
0% {
-o-transform-origin: right bottom;
-o-transform: rotate(90deg);
opacity: 0;
}
100% {
-o-transform-origin: right bottom;
-o-transform: rotate(0);
opacity: 1;
}
}
#keyframes rotateInDownRight {
0% {
transform-origin: right bottom;
transform: rotate(90deg);
opacity: 0;
}
100% {
transform-origin: right bottom;
transform: rotate(0);
opacity: 1;
}
}
.second_services .rotateInDownRight {
-webkit-animation-name: rotateInDownRight;
-moz-animation-name: rotateInDownRight;
-o-animation-name: rotateInDownRight;
animation-name: rotateInDownRight;
}
.second_services {
background: #31486f;
/* fallback for old browsers */
color: #fff;
font-family: 'Oswald', sans-serif;
}
/**
*
* Responsive list
*
**/
.second_services {
margin: 0;
padding: 0;
border: 0;
font: inherit;
font-size: 100%;
vertical-align: baseline;
height: 100vh;
}
.second_services .responsive {
width: 100%;
height: 100%;
display: flex;
}
.second_services .content {
width: 100%;
height: 100%;
display: flex;
flex-wrap: wrap;
flex: 1 1 100%;
margin: 0;
padding: 0;
}
.second_services .content img {
width: 100%;
height: 101%;
}
.second_services .content li {
border-bottom: 1px solid #2c2c2c;
border-left: 1px solid #2c2c2c;
flex: 1 1 calc(100% / 3);
box-sizing: border-box;
height: 25%;
position: relative;
display: flex;
flex-wrap: wrap;
/* Colors Hover */
}
.content li:hover {
cursor: pointer;
}
.content li:hover .card-front {
-webkit-transform: rotateX(50deg);
-moz-transform: rotateX(50deg);
-ms-transform: rotateX(50deg);
-o-transform: rotateX(50deg);
transform: rotateX(50deg);
-webkit-transform: perspective(1000) rotateX(50deg);
-moz-transform: perspective(1000) rotateX(50deg);
-ms-transform: perspective(1000) rotateX(50deg);
-o-transform: perspective(1000) rotateX(50deg);
transform: perspective(1000) rotateX(50deg);
}
.content li:hover .card-back {
z-index: 950;
-webkit-transform: rotateX(0deg);
-moz-transform: rotateX(0deg);
-ms-transform: rotateX(0deg);
-o-transform: rotateX(0deg);
transform: rotateX(0deg);
-webkit-transform: perspective(1000) rotateX(0deg);
-moz-transform: perspective(1000) rotateX(0deg);
-ms-transform: perspective(1000) rotateX(0deg);
-o-transform: perspective(1000) rotateX(0deg);
transform: perspective(1000) rotateX(0deg);
}
.content li:nth-child(n) .card-back {
background: #bea34d;
}
.content li:nth-child(1) h2,
.content li:nth-child(2) h2,
.content li:nth-child(3) h2 {
padding-top: 30px;
}
.content .card-front,
.content .card-back {
text-align: right;
-webkit-backface-visibility: hidden;
-moz-backface-visibility: hidden;
-ms-backface-visibility: hidden;
-o-backface-visibility: hidden;
backface-visibility: hidden;
-webkit-transition: -webkit-transform 400ms;
-moz-transition: -moz-transform 400ms;
-o-transition: -o-transform 400ms;
transition: transform 400ms;
display: block;
height: 100%;
position: absolute;
width: 100%;
}
.content .card-front {
-webkit-transform: perspective(1000) rotateX(0);
-moz-transform: perspective(1000) rotateX(0);
-ms-transform: perspective(1000) rotateX(0);
-o-transform: perspective(1000) rotateX(0);
transform: perspective(1000) rotateX(0);
z-index: 900;
}
.content .card-back {
-webkit-transform: rotateX(-180deg);
-moz-transform: rotateX(-180deg);
-ms-transform: rotateX(-180deg);
-o-transform: rotateX(-180deg);
transform: rotateX(-180deg);
z-index: 800;
}
.content h2 {
font-size: 2vw;
;
float: right;
width: 100%;
margin-bottom: 10px;
text-transform: uppercase;
margin-right: 20px;
margin-top: 20px;
color: #ffffff;
}
.content h2 b {
float: right;
width: 100%;
}
.content p {
line-height: 1.3em;
color: white;
width: 90%;
float: right;
margin-right: 20px;
}
.second_services .close {
cursor: pointer;
position: absolute;
right: 0;
top: 0;
background: #fff;
color: #111;
text-decoration: none;
font-size: 20px;
padding: 10px 20px;
background-color: #31486f;
color: #ffffff;
opacity: 1;
font-weight: 100;
padding-top: 3%;
}
.second_services .active {
width: 100% !important;
height: 100% !important;
}
.active .all-content {
position: absolute;
left: 10px;
top: 20px;
margin-left: 5%;
margin-right: 5%;
margin-top: 5%;
}
.active .all-content h1 {
font-size: 20px;
width: 100%;
color: #ffffff;
}
/*
#media (min-width: 1366px)
{
.second_services .close {
margin-top: 3%;
}
}
#media (min-width: 440px) and (max-width: 750px) {
.second_services .content h2 {
font-size: 22px;
}
.second_services .content p {
font-size: 13px;
}
.second_services .content li {
width: 33.1%;
}
}
#media (max-width: 439px) {
.second_services .content h2 {
font-size: 15px;
}
.second_services .content p {
font-size: 13px;
}
.second_services .content li {
width: 33%;
}
}
#media (max-height: 450px) {
.second_services .content h2 {
font-size: 22px;
}
.second_services .content h2 b {
width: 100%;
}
.second_services .content li {
width: 33%;
}
}
*/
#media (max-width: 1024px) {
.content p {
font-size: 13px;
}
.second_services .content li {
flex-basis: calc(100% / 2);
}
}
#media (max-width: 439px) {
.content h2 {
font-size: 5vw;
}
.second_services .content p {
font-size: 13px;
}
.second_services .content li {
width: 100%;
}
}
<div class="second_services" id="second_services">
<div class="responsive">
<ul class="content">
<li>
<div class="card-front">
<h2><b>One front</b></h2>
</div>
<div class="card-back">
<h2><b>One back</b></h2>
</div>
<!-- Content -->
<div class="all-content" style="display: none;">
<h1>Pomagamy na każdym etapie prowadzenia działalności. Doradzamy przy wyborze formy prawnej, załatwiamy wszystkie formalności związane z utworzeniem i rejestracją nowego podmiotu, pomagamy zorganizować Twoją działalność w zgodzie z obowiązującym
prawem.<br><br> Na kolejnym etapie dbamy o Twój komfort i bezpieczeństwo zapewniając skuteczne rozwiązania prawne dostosowane do Twoich potrzeb. Wykwalifikowany i doświadczony zespół pozwoli Ci zająć się tym co dla Ciebie najważniejsze - rozwijaniem
swojej działalności, bez potrzeby obawiania się o konsekwencje prawne swoich biznesowych decyzji.</h1>
</div>
</li>
<li>
<div class="card-front">
<h2><b>Two front</b></h2>
</div>
<div class="card-back">
<h2><b>Two back</b></h2>
</div>
<!-- Content -->
<div class="all-content" style="display: none;">
<h1>Prawo rodzinne</h1>
</div>
</li>
<li>
<div class="card-front">
<h2><b>Three front</b></h2>
</div>
<div class="card-back">
<h2><b>Three back</b></h2>
</div>
<!-- Content -->
<div class="all-content" style="display: none;">
<h1>In vulputate sem a arcu semper</h1>
</div>
</li>
<!-- 2 -->
<li>
<div class="card-front">
<h2><b>Four front</b></h2>
</div>
<div class="card-back">
<h2><b>Four back</b></h2>
</div>
<!-- Content -->
<div class="all-content" style="display: none;">
<h1>Etiam quis sapien interdum</h1>
</div>
</li>
<li>
<div class="card-front">
<h2><b>Five front</b></h2>
</div>
<div class="card-back">
<h2><b>Five back</b></h2>
</div>
<!-- Content -->
<div class="all-content" style="display: none;">
<h1>Vivamus metus massa</h1>
</div>
</li>
<li>
<div class="card-front">
<h2><b>Six front</b></h2>
</div>
<div class="card-back">
<h2><b>Six back</b></h2>
</div>
<!-- Content -->
<div class="all-content" style="display: none;">
<h1>Integer consequat vitae</h1>
</div>
</li>
<!-- 3 -->
<li>
<div class="card-front">
<h2><b>Seven front</b></h2>
</div>
<div class="card-back">
<h2><b>Seven back</b></h2>
</div>
<!-- Content -->
<div class="all-content" style="display: none;">
<h1>Duis tellus dui vehicula</h1>
</div>
</li>
<li>
<div class="card-front">
<h2><b>Eight front</b></h2>
</div>
<div class="card-back">
<h2><b>Eight back</b></h2>
</div>
<!-- Content -->
<div class="all-content" style="display: none;">
<h1>Ligula nulla tempus sem</h1>
</div>
</li>
<li>
<div class="card-front">
<h2><b>Nine fron</b></h2>
</div>
<div class="card-back">
<h2><b>Nine back</b></h2>
</div>
<!-- Content -->
<div class="all-content" style="display: none;">
<h1>Class aptent taciti sociosqu</h1>
</div>
</li>
<li>
<div class="card-front">
<h2><b>Ten front</b></h2>
</div>
<div class="card-back">
<h2><b>Ten back</b></h2>
</div>
<!-- Content -->
<div class="all-content" style="display: none;">
<h1>Class aptent taciti sociosqu</h1>
</div>
</li>
<li>
<div class="card-front">
<h2><b>Eleven front</b></h2>
</div>
<div class="card-back">
<h2><b>Eleven back</b></h2>
</div>
<!-- Content -->
<div class="all-content" style="display: none;">
<h1>Class aptent taciti sociosqu</h1>
</div>
</li>
<li>
<div class="card-front">
<h2><b>Twelve front</b></h2>
</div>
<div class="card-back">
<h2><b>Twelve back</b></h2>
</div>
<!-- Content -->
<div class="all-content" style="display: none;">
<h1>Class aptent taciti sociosqu</h1>
</div>
</li>
</ul>
</div>
</div>
Try to not mix flexbox with floats. You could also consider grid layout. Keeping your current html structure, I would do the following for minimal changes (see comments in css):
#second_services div.second_services {
margin: 0;
padding: 0;
border: 0;
font: inherit;
font-size: 100%;
vertical-align: baseline;
/* height: 100vh; Remove this*/
background: #31486f;
color: #fff;
}
.second_services .content {
/* float: left; Remove this */
width: 100%;
height: 100%;
/* Add the following three lines */
display: flex;
flex-direction: row;
flex-wrap: wrap;
}
.second_services .content li {
/* float: left; Remove this */
border-bottom: 1px solid #2c2c2c;
border-left: 1px solid #2c2c2c;
width: 33.2%;
height: 250px; /* Define a height: Could be with media queries */
position: relative;
display: flex;
flex-wrap: wrap;
}
I have problem with CSS below. In div with class front text is blurred like on this image
I'm using Chrome, but on every browser I see same blurred text. I want keep every div but I'm not sure what makes this text so blurred.
How I can fix it to make it no blure?
JsFiddle
HTML and CSS
.main {
margin: auto;
height: auto;
padding-top: 25px;
}
.panel {
width: 45%;
display: inline-block;
margin: 14px;
}
.est {
box-shadow: 0 0 0 #fff;
background-color: transparent;
}
.flip .back {
-webkit-transform: rotateY(360deg);
-moz-transform: rotateY(360deg);
-ms-transform: rotateY(360deg);
-o-transform: rotateY(360deg);
transform: rotateY(360deg);
}
#card-1,
#card-2,
#card-3,
#card-4,
#card-5 {
height: 300px;
width: 100%;
margin: 0 auto;
z-index: 1;
display: inline-block;
perspective: 700px;
}
h4,
.h4 {
font-size: 20px;
}
body {
font-size: 14px;
font-family: Roboto, sans-serif;
line-height: 1.35;
color: #222;
background: #f4f5f7;
text-rendering: optimizeLegibility;
padding: 0;
left: 0;
right: 0;
transition-duration: 200ms;
transition-timing-function: cubic-bezier(0.4, 0, 0.2, 1);
}
.front {
-webkit-transform: rotateY(0);
-moz-transform: rotateY(0);
-ms-transform: rotateY(0);
-o-transform: rotateY(0);
transform: rotateY(0);
z-index: 1;
}
.back,
.front {
border: 1px solid #ddd;
height: 100%;
top: 0;
transform-style: preserve-3d;
backface-visibility: hidden;
}
.back,
.front,
.front .info-box,
.social-bar {
position: absolute;
left: 0;
width: 100%;
}
.ease {
-webkit-transition: all .45s ease-out;
-moz-transition: all .45s ease-out;
-ms-transition: all .45s ease-out;
-o-transition: all .45s ease-out;
transition: all .45s ease-out;
}
.e-i-f-about,
.front,
.p-class-earn,
.strike {
overflow: hidden;
}
.back,
.flip .front {
-webkit-transform: rotateY(180deg);
-moz-transform: rotateY(180deg);
-ms-transform: rotateY(180deg);
-o-transform: rotateY(180deg);
transform: rotateY(180deg);
}
.back,
.front {
border: 1px solid #ddd;
height: 100%;
top: 0;
transform-style: preserve-3d;
backface-visibility: hidden;
}
.back,
.front,
.front .info-box,
.social-bar {
position: absolute;
left: 0;
width: 100%;
}
.back {
background-color: #fff;
display: table;
z-index: 2;
font-size: 13px;
line-height: 23px;
padding: 10px 20px;
height: 320px;
}
<div class="main pad-2">
<center>
<h4>Not blurred text</h4>
<div class="panel e-b est" style="margin-top:0">
<div class="wrapper">
<div id="card-1">
<div class="front ease">
Click
<div class="info-box">
<div class="info">
<h4>test1 blurred text</h4>
</div>
</div>
</div>
<div class="back ease">
2nd text here
</div>
</div>
</div>
</div>
<div class="panel e-b est" style="margin-top:0">
<div class="wrapper">
<div id="card-2">
<div class="front ease">
Click
<div class="info-box">
<div class="info">
<h4>test2 blurred text</h4>
</div>
</div>
</div>
<div class="back ease">
2nd text here
</div>
</div>
</div>
</div>
</center>
</div>
.featured_widgets {
margin: 4% 0px;
}
.featured_widgets .columns {
display: table;
margin-bottom: 20px;
text-align: center;
}
.featured_widgets .widget_box {
height: 156px;
text-align: center;
margin: 0px 1%;
vertical-align: middle;
width: 100%;
display: table-cell;
padding: 0px 20px;
}
.featured_widgets .widget_box .front img {
height: 120px;
}
.featured_widgets .widget_box .front {
height: 140px;
}
.featured_widgets .widget_box .back {
height: 140px;
padding-top: 40px;
color: #fff;
font-size: 17px;
}
.featured_widgets .columns .title {
display: table-row;
}
.featured_widgets .columns .title h5 {
color: #999;
padding: 0px 15px;
font-size: 15px;
}
.flip-container {
transform: perspective(1000px);
transform-style: preserve-3d;
}
.flip-container:hover .back,
.flip-container.hover .back {
transform: rotateY(0deg);
}
.flip-container:hover .front,
.flip-container.hover .front {
transform: rotateY(180deg);
}
.flipper {
perspective: 800px;
perspective-origin: 50% 100px;
position: relative;
transform: perspective(1000px);
transform-style: preserve-3d;
transition: all 0.6s ease 0s;
}
.front,
.back {
backface-visibility: hidden;
position: relative;
transform: rotateY(0deg);
transform-style: preserve-3d;
transition: all 1s ease 0.3s;
}
.front {
z-index: 2;
}
.back {
margin-top: -180px;
text-align: center;
transform: rotateY(-180deg);
}
.vertical.flip-container {
position: relative;
}
.vertical .back {
transform: rotateX(180deg);
}
.vertical.flip-container .flipper {
transform-origin: 100% 213.5px 0;
}
.vertical.flip-container:hover .back,
.vertical.flip-container.hover .back {
transform: rotateX(0deg);
}
.vertical.flip-container:hover .front,
.vertical.flip-container.hover .front {
transform: rotateX(180deg);
}
.seagreen_bg {
background: #1cbec9;
}
.inxblue_bg {
background: #0075ba;
}
.inxorange_bg {
background: #f37b20;
}
.inxyellow_bg {
background: #fdb813;
}
.btn_line {
border: 1px solid #fff;
border-radius: 5px;
display: inline-block;
font-size: 14px;
font-weight: normal;
margin-top: 10px;
padding: 8px 15px;
color: #fff;
}
.btn_line:hover {
background: #333 none repeat scroll 0 0;
border: 1px solid #000;
color: #fff;
text-decoration: none;
}
<div class="container">
<div class="row featured_widgets">
<div class="col-lg-3 col-md-3 col-sm-6 col-xs-12 columns flip-container vertical">
<div class="widget_box flipper seagreen_bg">
<div class="front">
<img src="https://cdn.sparkfun.com/assets/9/9/2/5/e/51f9a101757b7f032ab7f724.png" alt="">
</div>
<div class="back">
<h5>text text text text text text.</h5>
<h5><a class="btn_line" href="#">Learn More ›</a></h5>
</div>
</div>
<div class="title">
<h4>text</h4>
<h5>text text text text text text.</h5>
</div>
</div>
<div class="col-lg-3 col-md-3 col-sm-6 col-xs-12 columns flip-container vertical">
<div class="widget_box flipper inxblue_bg">
<div class="front">
<img src="https://cdn.sparkfun.com/assets/9/9/2/5/e/51f9a101757b7f032ab7f724.png" alt="">
</div>
<div class="back">
<h5>text text text text text text.</h5>
<h5><a class="btn_line" href="#">Learn More ›</a></h5>
</div>
</div>
<div class="title">
<h4>text</h4>
<h5>text text text text text text.</h5>
</div>
</div>
<div class="col-lg-3 col-md-3 col-sm-6 col-xs-12 columns flip-container vertical">
<div class="widget_box flipper inxorange_bg">
<div class="front">
<img src="https://cdn.sparkfun.com/assets/9/9/2/5/e/51f9a101757b7f032ab7f724.png" alt="">
</div>
<div class="back">
<h5>text text text text text text.</h5>
<h5><a class="btn_line" href="#">Learn More ›</a></h5>
</div>
</div>
<div class="title">
<h4>text</h4>
<h5>text text text text text text</h5>
</div>
</div>
<div class="col-lg-3 col-md-3 col-sm-6 col-xs-12 columns flip-container vertical">
<div class="widget_box flipper inxyellow_bg">
<div class="front">
<img src="https://cdn.sparkfun.com/assets/9/9/2/5/e/51f9a101757b7f032ab7f724.png" alt="">
</div>
<div class="back">
<h5>text text text text text text.</h5>
<h5><a class="btn_line" href="">Learn More ›</a></h>
</div>
</div>
<div class="title">
<h4>text</h4>
<h5>text</h5>
</div>
</div>
</div>
</div>
You need the -webkit- prefix to make it work in safari:
-webkit-transform: rotateY(180deg);
See compatibility table:
http://caniuse.com/#search=transform
Try This-
.featured_widgets {
margin: 4% 0px;
}
.featured_widgets .columns {
display: table;
margin-bottom: 20px;
text-align: center;
}
.featured_widgets .widget_box {
height: 156px;
text-align: center;
margin: 0px 1%;
vertical-align: middle;
width: 100%;
display: table-cell;
padding: 0px 20px;
}
.featured_widgets .widget_box .front img {
height: 120px;
}
.featured_widgets .widget_box .front {
height: 140px;
}
.featured_widgets .widget_box .back {
height: 140px;
padding-top: 40px;
color: #fff;
font-size: 17px;
}
.featured_widgets .columns .title {
display: table-row;
}
.featured_widgets .columns .title h5 {
color: #999;
padding: 0px 15px;
font-size: 15px;
}
.flip-container {
transform:perspective(1000px);
-moz-transform:perspective(1000px);
-ms-transform:perspective(1000px);
-o-transform:perspective(1000px);
-webkit-transform:perspective(1000px);
transform-style:preserve-3d;
}
.flip-container:hover .back ,
.flip-container.hover .back {
transform: rotateY(0deg);
-moz-transform: rotateY(0deg);
-ms-transform: rotateY(0deg);
-o-transform: rotateY(0deg);
-webkit-transform: rotateY(0deg);
}
.flip-container:hover .front ,
.flip-container.hover .front {
transform: rotateY(180deg);
-moz-transform: rotateY(180deg);
-ms-transform: rotateY(180deg);
-o-transform: rotateY(180deg);
-webkit-transform: rotateY(180deg);
}
.flipper {
perspective: 800px;
perspective-origin: 50% 100px;
position: relative;
transform: perspective(1000px);
-moz-transform: perspective(1000px);
-ms-transform: perspective(1000px);
-o-transform: perspective(1000px);
-webkit-transform: perspective(1000px);
transform-style: preserve-3d;
transition: all 0.6s ease 0s;
-moz-transition: all 0.6s ease 0s;
-ms-transition: all 0.6s ease 0s;
-o-transition: all 0.6s ease 0s;
-webkit-transition: all 0.6s ease 0s;
}
.front {
backface-visibility: hidden;
position: relative;
transform: rotateY(0deg);
-moz-transform: rotateY(0deg);
-ms-transform: rotateY(0deg);
-o-transform: rotateY(0deg);
-webkit-transform: rotateY(0deg);
transform-style: preserve-3d;
transition: all 1s ease 0.3s;
-moz-transition: all 1s ease 0.3s;
-ms-transition: all 1s ease 0.3s;
-o-transition: all 1s ease 0.3s;
-webkit-transition: all 1s ease 0.3s;
z-index: 2;
}
.back {
backface-visibility: hidden;
position: relative;
transform: rotateY(0deg);
-moz-transform: rotateY(0deg);
-ms-transform: rotateY(0deg);
-o-transform: rotateY(0deg);
-webkit-transform: rotateY(0deg);
transform-style: preserve-3d;
transition: all 1s ease 0.3s;
-moz-transition: all 1s ease 0.3s;
-ms-transition: all 1s ease 0.3s;
-o-transition: all 1s ease 0.3s;
-webkit-transition: all 1s ease 0.3s;
}
.back {
margin-top: -180px;
text-align: center;
transform: rotateY(-180deg);
-moz-transform: rotateY(-180deg);
-ms-transform: rotateY(-180deg);
-o-transform: rotateY(-180deg);
-webkit-transform: rotateY(-180deg);
}
.vertical.flip-container {
position: relative;
}
.vertical .back {
transform: rotateX(180deg);
-moz-transform: rotateX(180deg);
-ms-transform: rotateX(180deg);
-o-transform: rotateX(180deg);
-webkit-transform: rotateX(180deg);
}
.vertical.flip-container .flipper {
transform-origin: 100% 213.5px 0;
}
.vertical.flip-container:hover .back ,
.vertical.flip-container.hover .back {
transform: rotateX(0deg);
-moz-transform: rotateX(0deg);
-ms-transform: rotateX(0deg);
-o-transform: rotateX(0deg);
-webkit-transform: rotateX(0deg);
}
.vertical.flip-container:hover .front ,
.vertical.flip-container.hover .front {
transform: rotateX(180deg);
-moz-transform: rotateX(180deg);
-ms-transform: rotateX(180deg);
-o-transform: rotateX(180deg);
-webkit-transform: rotateX(180deg);
}
.seagreen_bg {
background: #1cbec9;
}
.inxblue_bg {
background: #0075ba;
}
.inxorange_bg {
background: #f37b20;
}
.inxyellow_bg {
background: #fdb813;
}
.btn_line {
border: 1px solid #fff;
border-radius: 5px;
-moz-border-radius: 5px;
-webkit-border-radius: 5px;
display: inline-block;
font-size: 14px;
font-weight: normal;
margin-top: 10px;
padding: 8px 15px;
color: #fff;
}
.btn_line:hover {
background: #333 none repeat scroll 0 0;
border: 1px solid #000;
color: #fff;
text-decoration: none;
}
I am trying to implement a vertical wobble effect on my anchor tag, an example can be found here:
http://ianlunn.github.io/Hover/
I have this is my mark up:
.hvr-wobble-vertical {
display: inline-block;
vertical-align: middle;
-webkit-transform: translateZ(0);
transform: translateZ(0);
box-shadow: 0 0 1px rgba(0, 0, 0, 0);
-webkit-backface-visibility: hidden;
backface-visibility: hidden;
-moz-osx-font-smoothing: grayscale;
}
<div class="col-lg-2 col-md-4 col-sm-6">
<div class="pin">
<a href="#" class="hvr-wobble-vertical">
<img src="http://cssdeck.com/uploads/media/items/2/2v3VhAp.png"/></a>
<p style="text-align: center;">
some clever text.
</p>
</div>
</div>
I am currently getting no result... Can someone give me some pointers of what I may be missing?
You're missing the animation keyframes :)
.hvr-wobble-vertical {
display: inline-block;
vertical-align: middle;
-webkit-transform: translateZ(0);
transform: translateZ(0);
box-shadow: 0 0 1px rgba(0, 0, 0, 0);
-webkit-backface-visibility: hidden;
backface-visibility: hidden;
-moz-osx-font-smoothing: grayscale;
}
.hvr-wobble-vertical:hover,
.hvr-wobble-vertical:focus,
.hvr-wobble-vertical:active {
-webkit-animation-name: hvr-wobble-vertical;
animation-name: hvr-wobble-vertical;
-webkit-animation-duration: 1s;
animation-duration: 1s;
-webkit-animation-timing-function: ease-in-out;
animation-timing-function: ease-in-out;
-webkit-animation-iteration-count: 1;
animation-iteration-count: 1;
}
/* Wobble Vertical */
#-webkit-keyframes hvr-wobble-vertical {
16.65% {
-webkit-transform: translateY(8px);
transform: translateY(8px);
}
33.3% {
-webkit-transform: translateY(-6px);
transform: translateY(-6px);
}
49.95% {
-webkit-transform: translateY(4px);
transform: translateY(4px);
}
66.6% {
-webkit-transform: translateY(-2px);
transform: translateY(-2px);
}
83.25% {
-webkit-transform: translateY(1px);
transform: translateY(1px);
}
100% {
-webkit-transform: translateY(0);
transform: translateY(0);
}
}
#keyframes hvr-wobble-vertical {
16.65% {
-webkit-transform: translateY(8px);
transform: translateY(8px);
}
33.3% {
-webkit-transform: translateY(-6px);
transform: translateY(-6px);
}
49.95% {
-webkit-transform: translateY(4px);
transform: translateY(4px);
}
66.6% {
-webkit-transform: translateY(-2px);
transform: translateY(-2px);
}
83.25% {
-webkit-transform: translateY(1px);
transform: translateY(1px);
}
100% {
-webkit-transform: translateY(0);
transform: translateY(0);
}
}
<div class="col-lg-2 col-md-4 col-sm-6">
<div class="pin">
<a href="#" class="hvr-wobble-vertical">
<img src="http://cssdeck.com/uploads/media/items/2/2v3VhAp.png" />
</a>
<p style="text-align: center;">
some clever text.
</p>
</div>
</div>
http://ianlunn.github.io/Hover/
https://github.com/IanLunn/Hover/blob/master/css/hover.css