I'm trying to create a flipbox with basic HTML and SCSS.
It's working as intended on Windows machines on every browser but I can't get it to work properly on Mac machines. It's not browser specific because it won't work properly on any browser on a Mac. The animation with the text is flickering and also the text disappears after the animation is done. I tried using different webkit solutions after Googling for a while, but none seem to fix my issue. I really hope someone here could help me out since I have no clue anymore on what is causing this issue. I do know that it has to do with the way it's getting rendered.
<div class="container">
<div class="row">
<div class="col-12 col-md-6 col-lg-3 d-flex team-card">
<!-- card container -->
<div class="extraSpacing">
<!-- inner -->
<div class="content front">
<div class="name text-center mx-auto mt-auto">
<p>Name</p>
</div>
<div class="function text-center mx-auto mt-auto">
<p style="text-transform:uppercase;font-size:12px;">Function</p>
</div>
<div class="social text-center">
<i class="fa fa-instagram"></i>
<i class="fa fa-twitter"></i>
<i class="fa fa-facebook"></i>
<i class="fa fa-linkedin"></i>
</div> <!-- /social -->
</div> <!-- /content front -->
<div class="back">
<p>Back card content</p>
</div>
</div> <!-- /inner -->
</div> <!-- /card container -->
</div> <!-- /row -->
#teamWrapper {
margin: 75px 0;
.team-card:hover .extraSpacing {
transform: rotateY(180deg);
-webkit-transform: rotateY(180deg);
}
.team-card {
position: relative;
margin-bottom: 20px;
padding: 0 8px;
transition: all .6s linear;
-webkit-transition: all .6s linear;
perspective: 1000px;
-webkit-perspective: 1000px;
.extraSpacing {
box-sizing: border-box;
width: 100%;
height: 365px;
background-size: cover;
background-repeat: no-repeat;
margin: 0;
transition: transform 0.8s;
-webkit-transition: transform 0.8s;
transform-style: preserve-3d;
-webkit-transform-style: preserve-3d;
}
.social {
margin-top: 15px;
i {
color: white;
margin: 0 10px;
font-size: 20px;
transition: .2s all;
-webkit-transition: .2s all;
&:hover {
color: red;
-webkit-transition: .2s all;
transition: .2s all;
}
}
}
.front {
position: absolute;
bottom: 30px;
left: 0;
right: 0;
backface-visibility: hidden;
-webkit-backface-visibility: hidden;
}
.back {
position: absolute;
z-index: 10;
background: white;
backface-visibility: hidden;
-webkit-backface-visibility: hidden;
transform: rotateY(180deg);
height: 100%;
display: flex;
p {
color: black;
font-size: 11px;
}
}
p {
color: white;
font-family: Arial, Helvetica, sans-serif;
font-size: 18px;
font-weight: bold;
}
}
The URL is: https://ikycreative.ikydev.nl/over-ons/ and the problem is with the team cards at the bottom of the page. It should flip over with a white background and black text, which it does on Windows (Chrome, Firefox) but not on Mac (Safari, Chrome, Firefox). It flickers a lot on Mac.
Many many thanks in advance, any help would be greatly appreciated since I am clueless.
JSFiddle:
https://jsfiddle.net/zLcjy4em/1/
Related
I'm attempting to centre an image and div layer inside a containing div, but so far I can't get it to move from the left of the column. I've tried a few different ways but just can't get it to move. Even the margin auto trick isn't working, which I suspect is because bootstrap 4 is a flex box now.
HTML:
#user-avatar {
background: #ff4e00;
border-radius: 50%;
width: 250px;
margin-bottom: 25px;
position: relative;
}
#user img {
border-radius: 50%;
width: 250px;
transition: .5s ease;
backface-visibility: hidden;
}
#user-avatar:hover img {
cursor: pointer;
opacity: 0.3;
}
.middle {
transition: .5s ease;
opacity: 0;
position: absolute;
top: 50%;
left: 50%;
transform: translate(-50%, -50%);
text-align: center;
}
.middle i {
font-size: 34px;
}
#user-avatar:hover .middle {
opacity: 1;
cursor: pointer;
}
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.12.4/jquery.min.js"></script>
<script src="https://stackpath.bootstrapcdn.com/bootstrap/4.2.1/js/bootstrap.min.js"></script>
<link href="https://stackpath.bootstrapcdn.com/bootstrap/4.2.1/css/bootstrap.min.css" rel="stylesheet"/>
<div id="user" class="col-12">
<div class="col-12" id="user-avatar">
<img class="mx-auto d-block" src="assets/users/av-lg/liane.png" />
<div class="middle">
<i class="fas fa-camera-alt"></i>
<p>Edit Avatar</p>
</div>
</div>
<p id="username" class="text-center"><span>Howdy </span>Liane</p>
<div id="xp-bar" class="text-left">
<div id="xp"><p><i class="fas fa-stars"></i> XP</p></div>
</div>
<p id="stats" class="text-right">Level 1</p>
</div>
It's the image and the 'underlay' ('middle' div) that I need to be in the center.
Add margin-left: 50% and transform: translateX(-50%) to #user-avatar. check below link.
thank you
http://jsfiddle.net/x1hphsvb/10994/
Add Class on id="user-avatar" to mx-auto
<div class="col-12 mx-auto" id="user-avatar">
<img class="d-block" src="assets/users/av-lg/liane.png" />
<div class="middle">
<i class="fas fa-camera-alt"></i>
<p>Edit Avatar</p>
</div>
</div>
https://jsfiddle.net/lalji1051/v06j8orn/9/
simply add this style - centrd now
#user-avatar {
margin: 0 auto;
}
Is it correct to add a div in a link?
I have some icons on my website, which through bootstrap when I mouse over them, increase the size slightly. The icons are within two div. I want that when clicking on the icon, in addition to that they increase in size, they take me to another page my site. I show you one of the div:
<section class="ulockd-service-three">
<div class="container">
<div class="col-xs-6 col-sm-4 col-md-2">
<div class="ulockd-srvc-column-two one text-center">
<div class="ulockd-srvc-details-two">
<div class="ulockd-srv-icon-two"><span class="flaticon work">
</span>
</div>
<h5>Safety Work</h5>
</div>
</div>
</div>
</div>
</section>
I have tried several ways to put the link, and finally I found one that redirects me to the desired page, but I do not know if it is the most correct way to do it, I do not think it is appropriate, it does not seem aesthetic.
This is how the link works:
<section class="ulockd-service-three">
<div class="container">
<div class="col-xs-6 col-sm-4 col-md-2">
<div class="ulockd-srvc-column-two one text-center">
<div class="ulockd-srvc-details-two">
<a href="about.html"><div class="ulockd-srv-icon-two">
<span class="flaticon-work"> </span>
</div></a>
<h5>Safety Work</h5>
</div>
</div>
</div>
</div>
</section>
What I want to say is that if it is within the allowed, taking into account everything, including if Google liked it or not.
Can you tell me the correct way to add a link to the icon without breaking the magnifying effect?
Thank you
I EDIT THE QUESTION:
I add css so you can help me, I hope to add what is necessary.
I searched for what I thought might affect the span
I EDIT THE QUESTION:
I add css and code snippet
What I want is to know if the way I put the link is correct, correct adding a div inside a link tag , if the syntax is correct.
I show a fragment of the code,
I do not know how to correctly add the "FLATICON" CDN, so you can not see the icon, if you can correct that for me to make it work, I would appreciate it.
.ulockd-srvc-column-two:hover .ulockd-srv-icon-two span {
transform: scale(1.2);
-webkit-transform: scale(1.2);
-moz-transform: scale(1.2);
-o-transform: scale(1.2);
-ms-transform: scale(1.2);
}
.ulockd-fservice-box .db-overlayer span {
border: 3px solid #fff;
bottom: 10px;
color: #fff;
font-size: 48px;
line-height: 1.2em;
padding: 0 10px;
position: absolute;
right: 10px;
}
.ulockd-fservice-box.style2 span {
border: 1px solid #fff;
padding: 10px 15px;
position: absolute;
}
.time_circles{position:relative;width:100%;height:100%}.time_circles > div{position:absolute;text-align:center}.time_circles > div > h4{margin:0;padding:0;text-align:center;text-transform:uppercase;font-family:'Century Gothic',Arial}.time_circles > div > span{display:block;width:100%;text-align:center;font-family:'Century Gothic',Arial;font-size:300%;margin-top:.4em;font-weight:700}
.ulockd-srv-icon {
padding: 10px;
}
.ulockd-srvc-column .ulockd-srv-icon {
color: #fff;
display: inline;
font-size: 36px;
line-height: 1.2em;
margin-top: 9px;
padding: 8px 13px;
position: relative;
}
.ulockd-srv-icon {
padding: 10px;
}
.ulockd-srvc-column .ulockd-srv-icon {
color: #fff;
display: inline;
font-size: 36px;
line-height: 1.2em;
margin-top: 9px;
padding: 8px 13px;
position: relative;
}
.ulockd-srvc-column .srv-icon {
font-size: 60px;
line-height: 1.2em;
-webkit-transition: all 0.3s ease-in-out 0s;
-moz-transition: all 0.3s ease-in-out 0s;
-ms-transition: all 0.3s ease-in-out 0s;
-o-transition: all 0.3s ease-in-out 0s;
transition: all 0.3s ease-in-out 0s;
}
.ulockd-srvc-column:hover .srv-icon{
transform: scale(1.4);
-webkit-transform: scale(1.4);
-moz-transform: scale(1.4);
-o-transform: scale(1.4);
-ms-transform: scale(1.4);
}
.ulockd-ap-srv-icon {
background-color: #393939;
padding: 10px;
}
.ulockd-ap-srvc-column{
margin-bottom: 45px;
position: relative;
}
.ulockd-ap-srvc-column .ulockd-ap-srv-icon {
color: #fff;
float: left;
font-size: 36px;
margin-top: 9px;
position: relative;
}
.ulockd-ap-srv-icon::before {
background-color: #393939;
border-left: 4px solid #fff;
border-right: 10px solid #393939;
content: "";
height: 100%;
left: -33%;
position: absolute;
top: 0;
transform: skewX(9deg);
-webkit-transform: skewX(9deg);
-moz-transform: skewX(9deg);
-o-transform: skewX(9deg);
-ms-transform: skewX(9deg);
width: 44%;
}
.ulockd-srv-icon-two {
padding: 10px;
}
.ulockd-srvc-column-two {
padding: 10px;
position: inherit;
margin-top: -200px;
z-index: 999;
}
.ulockd-srvc-column-two.one {
margin-top: 0;
}
.ulockd-srvc-column-two:hover {
cursor: pointer;
}
.ulockd-srvc-column-two:hover .ulockd-srv-icon-two span {
transform: scale(1.2);
-webkit-transform: scale(1.2);
-moz-transform: scale(1.2);
-o-transform: scale(1.2);
-ms-transform: scale(1.2);
}
.ulockd-srvc-column-two .ulockd-srv-icon-two {
color: #fff;
font-size: 60px;
line-height: 1.3em;
position: relative;
-webkit-transition: all 0.2s ease-in-out 0s;
-moz-transition: all 0.2s ease-in-out 0s;
-ms-transition: all 0.2s ease-in-out 0s;
-o-transition: all 0.2s ease-in-out 0s;
transition: all 0.2s ease-in-out 0s;
}
.ulockd-srv-icon-two{
padding-bottom: 0;
}
.ulockd-srvc-details-two {
padding-top: 0;
}
<html>
<head>
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css" integrity="sha384-BVYiiSIFeK1dGmJRAkycuHAHRg32OmUcww7on3RYdg4Va+PmSTsz/K68vbdEjh4u" crossorigin="anonymous">
<link rel="shortcut icon" href="http://sstatic.net/so/favicon.ico">
</head>
<body>
<!--THIS IS THE NATURAL WAY OF THE DIV-->
<section class="ulockd-service-two parallax" data-stellar-background-ratio="0.3">
<div class="container">
<div class="row">
<div class="col-xxs-12 col-xs-6 col-sm-6 col-md-4">
<div class="ulockd-srvc-column three text-center ulockd-mrgn650">
<div class="srv-icon text-thm1"><span class="flaticon-farm-2"></span></div>
<div class="srvc-details">
<h3>Excellent Services</h3>
<p>Consectetur adipisicing elit. Fugiat perspiciatis necessitatibus beatae debitis repudiandae illo nihil commodi consequuntur ipsum iusto.</p>
</div>
</div>
</div>
</div>
</div>
</section>
<!--AND THIS IS THE ONLY WAY I GOT TO ADD THE LINK WHEN WE CLICK THE ICON, SO THAT IT WORKS WITHOUT BREAKING THE STYLES OF THIS. And the one that I need to know if the syntax is correct-->
<section class="ulockd-service-two parallax" data-stellar-background-ratio="0.3">
<div class="container">
<div class="row">
<div class="col-xxs-12 col-xs-6 col-sm-6 col-md-4">
<div class="ulockd-srvc-column three text-center ulockd-mrgn650">
<!--this line is the one that I modify-->
<div class="srv-icon text-thm1"><span class="flaticon-farm-2"></span></div>
<div class="srvc-details">
<h3>Excellent Services</h3>
<p>Consectetur adipisicing elit. Fugiat perspiciatis necessitatibus beatae debitis repudiandae illo nihil commodi consequuntur ipsum iusto.</p>
</div>
</div>
</div>
</div>
</div>
</section>
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/js/bootstrap.min.js" integrity="sha384-Tc5IQib027qvyjSMfHjOMaLkfuWVxZxUPnCJA7l2mCWNIpG9mGCD8wGNIcPD7Txa" crossorigin="anonymous"></script>
</body>
</html>
You should remove the div operation span directly or maybe better
<section class="ulockd-service-three">
<div class="container">
<div class="col-xs-6 col-sm-4 col-md-2">
<div class="ulockd-srvc-column-two one text-center">
<div class="ulockd-srvc-details-two">
<span class="flaticon-work"> </span>
<h5>Safety Work</h5>
</div>
</div>
</div>
</div>
</section>
I don't know how to make text in the photo, and make a link in the whole photo. I've made a darkening effect which I don't want to change, I just want to add text to it. I really want to keep the current dimensions and, above all, responsiveness.
There is link to codepen: 'https://codepen.io/pawe-dejda/pen/XyPzpK'
body, html {
height: 100%;
}
.caption {
position: absolute;
left: 0;
top: 50%;
width: 100%;
text-align: center;
color: #000;
}
.responsive {
width: 100%;
max-width: 88px;
height: auto;
position: center;
}
.tz-gallery .row > div {
padding: 2px;
margin-bottom: 4px;
}
.tz-gallery .lightbox img {
width: 100%;
border-radius: 0;
position: relative;
}
#media(max-width: 768px) {
body {
padding: 0;
}
}
.fade {
opacity: 1;
transition: opacity .25s ease-in-out;
-moz-transition: opacity .25s ease-in-out;
-webkit-transition: opacity .25s ease-in-out;
}
.fade:hover {
opacity: 0.5;
}
<link rel="stylesheet" href="https://www.w3schools.com/w3css/3/w3.css">
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css">
<link rel="stylesheet" href="http://dejda.e-kei.pl/nuar/css/style.css">
<div class="w3-container w3-padding-64 w3-black">
<div class="w3-content">
<div class="tz-gallery">
<div class="row no-gutters">
<div class="col-sm-6 col-md-4">
<a class="lightbox fade" href="http://dejda.e-kei.pl/nuar/images/mieszkanie-w-kamienicy-lodz/mieszkanie-w-kamienicy-lodz5.jpg">
<img src="http://dejda.e-kei.pl/nuar/images/thumbnails/mieszkanie-w-kamienicy-lodz.jpg">
</a>
</div>
<div class="col-sm-6 col-md-4">
<a class="lightbox fade" href="http://dejda.e-kei.pl/nuar/images/mieszkanie-w-kamienicy-lodz/mieszkanie-w-kamienicy-lodz5.jpg">
<img src="http://dejda.e-kei.pl/nuar/images/thumbnails/mieszkanie-w-kamienicy-lodz.jpg">
</a>
</div>
<div class="col-sm-6 col-md-4">
<a class="lightbox fade" href="http://dejda.e-kei.pl/nuar/images/mieszkanie-w-kamienicy-lodz/mieszkanie-w-kamienicy-lodz5.jpg">
<img src="http://dejda.e-kei.pl/nuar/images/thumbnails/mieszkanie-w-kamienicy-lodz.jpg">
</a>
</div>
</div>
</div>
</div>
</div>
If i understand correctly, you want to be able to post links (link can be a-href, h1, h2, span etc') on top of your picture. To do so, do the following:
1. write a container div. for example:
<div>
text
</div>
set its style (CSS) to the background picture you want. Make sure the div's sizes fit the picture size. Then, inside the div you can simply write down the tag you wish (text). for example:
< span >
text
< /span >
Now things get interesting. In order to position the text inside the div? => set the div's position to relative (position:relative;) and set the span position to absolute. then play around with the top / left / bottom / right of the absoloute position, and text would appear whereever you want it to.
Here's an updated codepen
https://codepen.io/kelvinsusername/pen/YROYZM
It adds a container with some text in it but makes it opaque, then on hover instead of making it less visible (like the image) it makes it more visible.
.fade:hover .description {
opacity: 1;
}
.description {
position: absolute;
z-index: 100;
opacity: 0;
color: #fff;
font-size: 20px;
}
.tz-gallery .row>div {
padding: 2px;
margin-bottom: 4px;
}
.tz-gallery .lightbox img {
width: 100%;
border-radius: 0;
position: relative;
}
.img-text-box {
position: absolute;
bottom: 0;
background: rgba(0, 0, 0, 0.479);
color: #ffffff;
width: 100%;
padding: 20px;
font-family: Arial;
font-size: 17px;
}
.fade {
opacity: 1;
transition: opacity .25s ease-in-out;
-moz-transition: opacity .25s ease-in-out;
-webkit-transition: opacity .25s ease-in-out;
color: #e9e9e9;
}
.fade:hover {
opacity: 0.5;
}
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css">
<div class="tz-gallery">
<div class="container">
<div class="row">
<div class="col-md-4">
<a class="lightbox fade" href="">
<img src="http://dejda.e-kei.pl/nuar/images/thumbnails/mieszkanie-w-kamienicy-lodz.jpg" alt="">
<div class="img-text-box">
<p>Be brave js is cool</p>
</div>
</a>
</div>
<div class="col-md-4">
<a class="lightbox fade" href="">
<img src="http://dejda.e-kei.pl/nuar/images/thumbnails/mieszkanie-w-kamienicy-lodz.jpg" alt="">
<div class="img-text-box">
<p>Readability counts.</p>
</div>
</a>
</div>
<div class="col-md-4">
<a class="lightbox fade" href="">
<img src="http://dejda.e-kei.pl/nuar/images/thumbnails/mieszkanie-w-kamienicy-lodz.jpg" alt="">
<div class="img-text-box">
<p>If the implementation is hard to explain, it's a bad idea.</p>
</div>
</a>
</div>
</div>
</div>
</div>
hello guys I am designing a website which consist of an image and a hover effect which fades out a text. it is pretty working fine but it became a mess when i resized the browser window, the image is still positioned but the hover content resizes i just want it to be the same size with the image on resize.
Any way out of this mess, any answer is appreciated thanks.
figure {
overflow: hidden;
margin: 0;
padding: 0;
}
figure:hover img {
transition-duration: 0.8s;
}
figure figcaption {
position: absolute;
top: 0;
left: 20px;
width: 90% !important;
height: 95%;
opacity: 0;
transition-duration: 0.8s;
color: #000;
}
figure:hover figcaption {
opacity: 1;
}
.styleme {
background: #fff;
font-family: playball;
margin-top: 36%;
height: 80px;
}
<div class="row">
<div class="col-lg-6 col-md-4 col-sm-6 col-xs-12">
<div class="thumbnail">
<figure>
<img class="img-responsive" src="macbookair11_lifestyle_20.jpg" />
<figcaption>
<div class="styleme">
<p>This is the Apple macbook and it is pro <i class="fa fa-apple"></i> justclick to purchase</p>
<p>Proccessor: works at 3.14Ghz</p>
<p>Internal Ram: It has a Ram of 8GB <i class="fa fa-bars" aria-hidden="true"></i></p>
</div>
</figcaption>
</figure>
</div>
</div>
</div>
Evidently, your image must be very large if you want it to fill most of the page. I have used a small image and sized appropriately for demo purposes.
The key difference I made was to use display:block and position:relative.
It's good to minimise the use of absolute positioning where possible. (That's why I adjusted the top and left to margin-top and margin-left)
Adjust the numbers in the css as you see appropriate
Hope this helps
figure {
overflow: hidden;
margin: 0;
padding: 0;
}
figure:hover img {
transition-duration: 0.8s;
}
figure figcaption {
display:block;
position: relative;
margin-top: 0;
margin-left: 20px;
width: 400px !important;
height: 450px;
opacity: 0;
transition-duration: 0.8s;
color: #000;
}
figure:hover figcaption {
opacity: 1;
}
.styleme {
background: #fff;
font-family: playball;
margin-top: 10%;
height: 80px;
}
<link href="//netdna.bootstrapcdn.com/font-awesome/4.0.3/css/font-awesome.min.css" rel="stylesheet"/>
<div class="row">
<div class="col-lg-6 col-md-4 col-sm-6 col-xs-12">
<div class="thumbnail">
<figure>
<img class="img-responsive" src="https://encrypted-tbn0.gstatic.com/images?q=tbn:ANd9GcSs87UCUOVgNUoz7-AlLppXgeDyC1DnITzZjk6xMJN4P94oMps1" />
<figcaption>
<div class="styleme">
<p>This is the Apple macbook and it is pro <i class="fa fa-apple"></i> justclick to purchase</p>
<p>Proccessor: works at 3.14Ghz</p>
<p>Internal Ram: It has a Ram of 8GB <i class="fa fa-bars" aria-hidden="true"></i></p>
</div>
</figcaption>
</figure>
</div>
</div>
</div>
EDIT: (snippet 2 with larger image)
*{margin:0; padding:0;}
.thumbnail{
background: #fff;
}
figure img{
width:90%!important;
height: auto;
overflow: hidden;
margin: 0 auto;
}
figure:hover img {
transition-duration: 0.8s;
}
figure figcaption{
display:block;
position: relative;
opacity: 0;
transition-duration: 0.8s;
color: #000;
}
figure:hover figcaption {
opacity: 1;
}
.styleme {
background: #fff;
font-family: playball;
padding-top: 5%;
padding-left: 20px;
width:90%;
height:10%;
}
<link href="https://netdna.bootstrapcdn.com/font-awesome/4.0.3/css/font-awesome.min.css" rel="stylesheet"/>
<div class="row">
<div class="col-lg-6 col-md-4 col-sm-6 col-xs-12">
<div class="thumbnail">
<figure>
<img class="img-responsive" src="https://encrypted-tbn0.gstatic.com/images?q=tbn:ANd9GcQmGtZotDeGTAe1MOM1QZ-g6HfFnBCE3ASqsoUcSmfcMgHLPSOMyw" />
<figcaption>
<div class="styleme">
<p>This is the Apple macbook and it is pro <i class="fa fa-apple"></i> just click to purchase</p>
<p>Processor: works at 3.14Ghz</p>
<p>Internal Ram: It has a Ram of 8GB <i class="fa fa-bars" aria-hidden="true"></i></p>
</div>
</figcaption>
</figure>
</div>
</div>
</div>
https://jsfiddle.net/RachGal/4yqLeey9/
I have 3 boxes within a fluid container.
Each box has a heading title, an icon and some text below.
On :hover I want the icon to move to the top of the <div> and change it's size, I have managed to "achieve" it but using certain number of pixels.
That will not work in mobile resolutions if the title text is longer and takes 2 lines.
Here is what I have done so far:
Fiddle here
HTML
<div class="container">
<div class="row">
<div class="col-lg-4 col-md-4 col-sm-4 col-xs-12 text-center market-blocks orange wow rollIn">
<div class="service-box">
<h2>Title</h2>
<i class="fa fa-5x fa-paper-plane wow bounceIn market-icon" data-wow-delay=".1s"></i>
<p class="">Certain text below the icon</p>
</div>
</div>
</div>
CSS
.container{
text-align:center;
}
.market-blocks{
background: #3aa0d1;
padding: 30px 0 30px 0;
cursor:pointer;
}
.orange{
background: #e97d68;
}
i.market-icon {
-webkit-transition: 1s ease-in;
-moz-transition: 1s ease-in;
-o-transition: 1s ease-in;
transition: 1s ease-in
}
.market-blocks:hover i.market-icon {
-webkit-transform: translate(0,-70px);
-moz-transform: translate(0,-70px);
-o-transform: translate(0,-70px);
-ms-transform: translate(0,-70px);
transform: translate(0,-70px);
font-size: 1.8em;
}
How can I do it? And also is there a better way to do the movement from the initial position to the top of the <div>?
Pure HTML/CSS solution:
.container {
text-align: center;
}
.market-blocks {
background: #3aa0d1;
padding: 30px 0;
cursor: pointer;
}
.orange {
background: #e97d68;
}
.service-box {
display: inline-block;
}
.service-box-header {
position: relative;
}
.market-title {
padding-bottom: 5em;
-webkit-transition: 1s ease-in;
transition: 1s ease-in
}
.market-icon {
position: absolute;
right: 0;
bottom: 0;
left: 0;
-webkit-transition: 1s ease-in;
transition: 1s ease-in
}
.market-blocks:hover .market-title {
padding-bottom: 0;
}
.market-blocks:hover .market-icon {
bottom: 100%;
font-size: 1.8em;
}
<link href="http://maxcdn.bootstrapcdn.com/font-awesome/4.2.0/css/font-awesome.min.css" rel="stylesheet"/>
<div class="container">
<div class="row">
<div class="col-lg-4 col-md-4 col-sm-4 col-xs-12 text-center market-blocks orange wow rollIn">
<div class="service-box">
<div class="service-box-header">
<h2 class="market-title">Very-very-very-very-very-very-very-very loooooooooooooooooooong title</h2>
<i class="fa fa-5x fa-paper-plane wow bounceIn market-icon"></i>
</div>
<p class="">Certain text below the icon</p>
</div>
</div>
</div>
</div>