I am making images with text on flipping cards. I am trying to put them on the site so there would be about nine of them, each time three of them next to one another. Here is my code. Please just simply directly tell me how to implement it as I did not manage to fix the issue myself beforehand. I have no exp with HTML or CSS and just need a quick fix for the site. Thanks!
So the HTML bit in the end will be reproduced about nine times, the implementation has to be efficient for each copy.
<style> #f1_container {
position: margin-left;
margin: 10px;
width: 150%;
height: 150%;
z-index: 1;
}
#f1_container {
perspective: 1000;
}
#f1_card {
width: 113px;
height: 170px;
transform-style: preserve-3d;
transition: all 1.0s linear;
}
#f1_container:hover #f1_card {
transform: rotateY(180deg);
box-shadow: -5px 5px 5px #aaa;
}
.face {
position: absolute;
width: 150%;
height: 150%;
backface-visibility: hidden;
}
.face.back {
display: block;
transform: rotateY(180deg);
box-sizing: border-box;
padding: 10px;
color: white;
text-align: center;
background-color: #aaa;
}
</style>
<div id="f1_container">
<div id="f1_card" class="shadow">
<div class="front face">
<img src="http://img11.hostingpics.net/pics/714153square1.png"/>
</div>
<div class="back face center">
<p>TContent</p>
<p>Content</p>
</div>
.cardCont {
display: inline-block;
padding: 20px;
}
/*sets transition speed for the card flip you can change this*/
.Card {
height: 150px;
width: 150px;
border: 1px solid black;
transition: all .4s;
}
/*rotates on hover of outer div*/
.cardCont:hover .Card {
transform: rotateY(-180deg);
}
/*sets transitions for the front and back.. delay should half the transition this way this will only show when the card is half flipped*/
.Card .front,
.Card .back {
transition: all .1s;
transition-delay: .2s;
}
/*fixes the fact that this will now be backwards and hides it normally*/
.Card .back {
transform: rotateY(180deg);
display: none;
width: 100%;
}
/*following 2 set default properties for the front and back.*/
.cardCont:hover .Card .front {
display: none;
}
.cardCont:hover .Card .back {
display: inline-block;
}
<div class="cardCont">
<div class="Card">
<div class="front">Card1 Front
<br />you can put what you want in here.. this is the front</div>
<div class="back">Card1 Back
<br />you can put what you want in here.. this is the back</div>
</div>
</div>
<div class="cardCont">
<div class="Card">
<div class="front">Card2 Front
<br />you can put what you want in here.. this is the front</div>
<div class="back">Card2 Back
<br />you can put what you want in here.. this is the back</div>
</div>
</div>
Related
I am able to achieve smooth in and out effect using transform and transition. I was experimenting with animation but could not achieve smooth out effect.
The first example below works. Note that when you hover, the card will move. And when you no longer hover, the cards to the right will close in slowly.
The second example is the one I'm trying to improve. How can you make the cards close in slowly when using animation? Thanks in advance.
EXAMPLE 1
.container {
display: flex;
margin-top: 100px;
justify-content: center;
}
.card {
height: 200px;
width: 200px;
background-color: antiquewhite;
border: 1px solid black;
border-radius: 15px;
box-shadow: 1px 1px 15px 1px;
display: flex;
justify-content: center;
align-items: center;
transition: 1s;
}
.card:not(:first-child) {
margin-left: -150px;
}
.card:hover {
transform: translateY(-20px);
}
.card:not(:last-child):hover ~ .card {
transform: translateX(170px);
}
<div class="container">
<div class="card">
CARD
</div>
<div class="card">
CARD
</div>
<div class="card">
CARD
</div>
<div class="card">
CARD
</div>
<div class="card">
CARD
</div>
</div>
EXAMPLE 2
.container2 {
display: flex;
justify-content: center;
margin-top: 200px;
}
.tile {
height: 200px;
width: 200px;
background-color: antiquewhite;
border: 1px solid black;
border-radius: 15px;
box-shadow: 1px 1px 15px 1px;
display: flex;
justify-content: center;
align-items: center;
}
.tile:not(:first-child) {
margin-left: -150px;
}
.tile:not(:last-child):hover ~ .tile {
animation: slide 0.8s linear forwards;
}
#keyframes slide {
0% {
transform: translateX(0px);
}
100% {
transform: translateX(170px);
}
}
.tile:hover {
animation: float 0.8s forwards;
}
#keyframes float {
0% {
transform: translateY(0px);
}
100% {
transform: translateY(-15px);
}
}
<div class="container container2">
<div class="tile">
CARD
</div>
<div class="tile">
CARD
</div>
<div class="tile">
CARD
</div>
<div class="tile">
CARD
</div>
<div class="tile">
CARD
</div>
</div>
hi in the tile class you should add an animation like this:
.tile {
height: 200px;
width: 200px;
background-color: antiquewhite;
border: 1px solid black;
border-radius: 15px;
box-shadow: 1px 1px 15px 1px;
display: flex;
justify-content: center;
align-items: center;
animation-duration: 0.8s;}
I have a group of images and what I want is to be able to flip the image. For the front of the image it will show numbers(see image below) and on the back it will have a picture. If the user clicks another image and it matches the first picture clicked, then it will disappear after a couple of seconds. Right now I am stuck on getting the images to flip. I will paste my html code and css down below.
To make the image flip I tried using the hover effect but this did not work either
#flipper:hover {
transform: rotateY(180deg);
}
body {
color: black;
}
ul {
list-style-type: none;
margin: 0;
padding: 0;
overflow: hidden;
background-color: #333;
}
li {
float: left;
}
li a {
display: block;
color: white;
text-align: center;
padding: 14px 16px;
text-decoration: none;
}
li a:hover {
background-color: #111;
}
h2 {
text-align: center;
}
body {
background-color: white;
}
img {
width: 30%;
float: left;
margin: 1.66%;
}
p {
margin-left: 1.66%;
font-family: "Contrail One", cursive;
font-size: 35px;
text-transform: uppercase;
border-bottom: 2px solid black;
width: 30%;
padding-bottom: 20px;
}
div.a {
text-align: center;
font-family: sans-serif;
}
#flipper:hover {
transform: rotateY(180deg);
}
<link href="https://fonts.googleapis.com/css?family=Contrail+One" rel="stylesheet">
<div id="flipper">
<img class="flip" src="http://c1.staticflickr.com/9/8450/8026519634_f33f3724ea_b.jpg" alt="">
<img src="http://c1.staticflickr.com/9/8450/8026519634_f33f3724ea_b.jpg" alt="">
<img src="http://c2.staticflickr.com/8/7218/7209301894_c99d3a33c2_h.jpg " alt="">
<img src="http://c2.staticflickr.com/8/7218/7209301894_c99d3a33c2_h.jpg " alt="">
<img src="http://c2.staticflickr.com/8/7231/6947093326_df216540ff_b.jpg " alt="">
<img src="http://c2.staticflickr.com/8/7231/6947093326_df216540ff_b.jpg " alt="">
<img src="http://c1.staticflickr.com/9/8788/17367410309_78abb9e5b6_b.jpg " alt="">
<img src="http://c1.staticflickr.com/9/8788/17367410309_78abb9e5b6_b.jpg " alt="">
</div>
I think to start off, i couldnt tell if you had already linked your written CSS to your HTML. I see only 1 link and its not to your css. Looks like a google font.
I created a https://codepen.io/robert9111/pen/MzabWZ
<!-- HTML -->
<div id="f1_container">
<div id="f1_card" class="shadow">
<div class="front face">
<img class="size" src="http://c1.staticflickr.com/9/8450/8026519634_f33f3724ea_b.jpg/">
</div>
<div class="back face center">
<p>This is nice for exposing more information about an image.</p>
<p>Any content can go here.</p>
</div>
</div>
</div>
<!-- CSS -->
#f1_container {
position: relative;
margin: 10px auto;
width: 450px;
height: 281px;
z-index: 1;
}
.size {
width: 450px;
height: 281px;
}
#f1_container {
perspective: 1000;
}
#f1_card {
width: 100%;
height: 100%;
transform-style: preserve-3d;
transition: all 1.0s linear;
}
#f1_container:hover #f1_card {
transform: rotateY(180deg);
box-shadow: -5px 5px 5px #aaa;
}
.face {
position: absolute;
width: 100%;
height: 100%;
backface-visibility: hidden;
}
.face.back {
display: block;
transform: rotateY(180deg);
box-sizing: border-box;
padding: 10px;
color: white;
text-align: center;
background-color: #aaa;
}
for you to check out. I think this may solve your issue.
I didn't do them all as I think it would be good for you to write out some of that code.
I am trying to make a node that can zoom its picture when hovered upon. Everything works fine on Chrome and Mozilla. However, for some reason Safari gets buggy every time the image is on hover. The border radius disappears when hovered into a sharp edge and reappears when un-hovered. Here is an example: FIDDLE
.img-zoom {
top: 0;
left: 0;
margin: 0;
display: block;
width: 100%;
height: 60%;
position: relative;
overflow: hidden;
}
.img-zoom img {
-webkit-transform: scale(1.04);
-ms-transform: scale(1.04);
transform: scale(1.04);
transition: all 1.1s cubic-bezier(0.25, 0.46, 0.45, 0.94);
}
.img-zoom img:hover {
-webkit-transform: scale(1.1);
-ms-transform: scale(1.1);
transform: scale(1.1);
}
.blogDesc {
background-color: whitesmoke;
width: 100%;
height: 40%;
}
.blogContent {
width: 200px;
height: 200px;
word-wrap: break-word;
border-radius:25px;
overflow: hidden;
display:inline-block;
margin:10px;
}
.blogTitle {
font-weight: bold;
font-family: "Courier New";
text-align: center;
padding: 10px;
}
.blogText {
-webkit-column-width: 150px;
column-width: 150px;
height: 100%;
margin-left: 10px;
margin-right: 10px;
}
.blogAlign{
text-align:center;
}
<section class="blogAlign">
<div class="blogContent">
<div class="img-zoom"><img src="https://kbob.github.io/images/sample-3.jpg" alt="" title=""></div>
<div class="blogDesc">
<div class="blogTitle">
My Multimedia Agency Tool
</div>
<div class="blogText">
BBLALBLABLALBALBLBALBALBALBLABLABLABLABLABLALBLABLABLABLALBALBLABLABLABLABLALBLABBBLALBLABLALBALBLBALBALBALBLABLABLABLABLABLALBLABLABLABLALBALBLABLABLABLABLALBLABBBLALBLABLALBALBLBALBALBALBLABLABLABLABLABLALBLABLABLABLALBALBLABLABLABLABLALBLABBBLALBLABLALBALBLBALBALBALBLABLABLABLABLABLALBLABLABLABLALBALBLABLABLABLABLALBLAB
</div>
</div>
</div>
<div class="blogContent">
<div class="img-zoom"><img src="https://kbob.github.io/images/sample-3.jpg" alt="" title=""></div>
<div class="blogDesc">
<div class="blogTitle">
My Multimedia Agency Tool
</div>
<div class="blogText">
BBLALBLABLALBALBLBALBALBALBLABLABLABLABLABLALBLABLABLABLALBALBLABLABLABLABLALBLABBBLALBLABLALBALBLBALBALBALBLABLABLABLABLABLALBLABLABLABLALBALBLABLABLABLABLALBLABBBLALBLABLALBALBLBALBALBALBLABLABLABLABLABLALBLABLABLABLALBALBLABLABLABLABLALBLABBBLALBLABLALBALBLBALBALBALBLABLABLABLABLABLALBLABLABLABLALBALBLABLABLABLABLALBLAB
</div>
</div>
</div>
<div class="blogContent">
<div class="img-zoom"><img src="https://kbob.github.io/images/sample-3.jpg" alt="" title="" class="picturez"></div>
<div class="blogDesc">
<div class="blogTitle">
My Multimedia Agency Tool
</div>
<div class="blogText">
BBLALBLABLALBALBLBALBALBALBLABLABLABLABLABLALBLABLABLABLALBALBLABLABLABLABLALBLABBBLALBLABLALBALBLBALBALBALBLABLABLABLABLABLALBLABLABLABLALBALBLABLABLABLABLALBLABBBLALBLABLALBALBLBALBALBALBLABLABLABLABLABLALBLABLABLABLALBALBLABLABLABLABLALBLABBBLALBLABLALBALBLBALBALBALBLABLABLABLABLABLALBLABLABLABLALBALBLABLABLABLABLALBLAB
</div>
</div>
</div>
</section>
Does anyone know how to fix this? Thanks in advance.
<div class="activity_rounded"><img src="http://placehold.it/100" /></div>
.activity_rounded {
display: inline-block;
-webkit-border-radius: 50%;
-moz-border-radius: 50%;
border-radius: 50%;
-khtml-border-radius: 50%;
border: 3px solid #fff;
}
.activity_rounded img {
-webkit-border-radius: 50%;
-moz-border-radius: 50%;
border-radius: 50%;
-khtml-border-radius: 50%;
vertical-align: middle;
}
it should work properly.
How can I modify the styles below to result in the elements having the same spacing between each after the scaling? (without absolutely positioning them)
Desired Result:
.menu-next, .menu-previous1 {
transform: scale(.9); transform-origin: left;
}
.menu-previous2 { transform: scale(.7); transform-origin: left;}
.menu-previous3 { transform: scale(.55); transform-origin: left;}
.menu {
background-color: gray;
padding: 10px;
}
.menu div {
display: block;
width: 20%;
padding: 10px;
background-color: white;
color: green;
}
<div class="menu">
<div class="menu-previous3">Items</div>
<div class="menu-previous2">Store</div>
<div class="menu-previous1">Friends</div>
<div class="menu-current" >Settings</div>
<div class="menu-next" >Other</div>
</div>
Use scale(x, y) and not scale(value) + transform-origin
.menu-next,
.menu-previous1 {
transform: scale(.9, 1);
transform-origin: left;
}
.menu-previous2 {
transform: scale(.7, 1);
transform-origin: left;
}
.menu-previous3 {
transform: scale(.55, 1);
transform-origin: left;
}
.menu {
display: flex;
flex-direction: column;
justify-content: center;
background-color: gray;
padding: 10px;
}
.menu div {
display: block;
width: 20%;
padding: 10px;
background-color: white;
border: 1px solid green;
color: green;
}
<div class="menu">
<div class="menu-previous3">Items</div>
<div class="menu-previous2">Store</div>
<div class="menu-previous1">Friends</div>
<div class="menu-current">Settings</div>
<div class="menu-next">Other</div>
</div>
With thatthere is an other problem : scalling text. But you can fix that with pseudo-element (like here)
The best way is to wrap the scaling items and apply the other ui properties seperately of items to that wrapping div and then apply the scaling to the item inside it only.
Here is your code with this theory applied and a little change of padding and margin for equal spacing:
.itemwrapper .menu-next, .itemwrapper .menu-previous1 {
transform: scale(.9); transform-origin: left;
}
.itemwrapper .menu-previous2 { transform: scale(.7); transform-origin: left;}
.itemwrapper .menu-previous3 { transform: scale(.55); transform-origin: left;}
.menu {
background-color: gray;
padding: 10px;
}
.itemwrapper{
display: block;
width: 20%;
padding: 5px 10px;
margin:2px;
background-color: white;
color: green;
}
<div class="menu">
<div class="itemwrapper"><div class="menu-previous3">Items</div></div>
<div class="itemwrapper"><div class="menu-previous2">Store</div></div>
<div class="itemwrapper"><div class="menu-previous1">Friends</div></div>
<div class="itemwrapper"><div class="menu-current" >Settings</div></div>
<div class="itemwrapper"><div class="menu-next" >Other</div></div>
</div>
Hope this helps.
May be you can adjust it by hand ... Not really a good solution, but it is difficult to go any better.
.menu-next,
.menu-previous1 {
transform: scale(.9);
}
.menu-previous2 {
transform: scale(.7);
margin-bottom: -6px;
}
.menu-previous3 {
transform: scale(.55);
margin-bottom: -12px;
}
.menu {
background-color: gray;
padding: 10px;
}
.menu div {
display: block;
width: 20%;
padding: 10px;
background-color: white;
color: green;
transform-origin: left;
}
<div class="menu">
<div class="menu-previous3">Items</div>
<div class="menu-previous2">Store</div>
<div class="menu-previous1">Friends</div>
<div class="menu-current">Settings</div>
<div class="menu-next">Other</div>
</div>
Based a bit off this answer and sort of hack-y: https://stackoverflow.com/a/16388428/1204415
Wrap your scaled divs, resize the wrappers, and move the scaled divs with negative margins within the wrappers. scale() seems to also scale borders, margins, and padding.
HTML
<div class="menu">
<div class="wrap1">
<div class="item menu-previous3">Items</div>
</div>
<div class="wrap2">
<div class="item menu-previous2">Store</div>
</div>
<div class="item menu-previous1">Friends</div>
<div class="item menu-current" >Settings</div>
<div class="item menu-next" >Other</div>
</div>
CSS
.wrap1 {
height: 20px;
margin: 0;
overflow: hidden;
background-color: black;
}
.wrap2 {
height: 32px;
margin: -5px 0 0 0;
overflow: hidden;
background-color: blue;
}
.menu-next, .menu-previous1 {
transform: scale(.9); transform-origin: left;
}
.menu-previous2 { transform: scale(.7); transform-origin: left;}
.menu-previous3 { transform: scale(.55); transform-origin: left; margin: -8px 0 0 0; }
.menu {
background-color: gray;
padding: 10px;
}
.menu .item {
display: block;
outline:1px solid red;
width: 20%;
padding: 10px;
background-color: white;
color: green;
}
A pen: https://codepen.io/dmoz/pen/vmjybo
I want these images above to pop up when someone hovers over them, each image pops up and comes to the center when someone hovers a mouse over the image, also they should be arranged in that format. I want to do this in WordPress, I am designing a website and the client wants that effect. Is it possible friends? please someone assist me.
HTML code
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.1.0/jquery.min.js"></script>
<nav>
<img src="http://winn-brown.co.uk/wp-content/uploads/2016/06/Logo-new.png" id="logo">
</nav>
<div class="wrapper">
<div class="parent" onclick="">
<div class="child bg-one">
Los Angeles
</div>
</div>
<div class="parent right" onclick="">
<div class="child bg-two">
London
</div>
</div>
<div class="parent" onclick="">
<div class="child bg-three">
New York
</div>
</div>
<div class="parent right" onclick="">
<div class="child bg-four">
Hollywood
</div>
</div>
<div class="parent" onclick="">
<div class="child bg-five">
Dubai
</div>
</div>
<div class="parent right" onclick="">
<div class="child bg-six">
San Francisco
</div>
</div>
</div>
CSS Code
/* Global Styling */
html, body {margin:0px; padding: 0px;}
nav {
background-color: #34495e;
height: 80px;
position: fixed;
width: 100vw;
top: 0;
z-index: 999;
}
#logo {height: 80px; margin-left: 20px;}
.wrapper {
padding: 50px 50px;
max-width: 1200px;
text-align: center;
margin-left: auto;
margin-right: auto;
margin-top: 80px;
}
.right {float: right !important;}
/* Image zoom on hover + Overlay colour */
.parent {
width: 45%;
margin: 20px;
height: 300px;
border: 1px solid blue;
overflow: hidden;
position: relative;
float: left;
display: inline-block;
cursor: pointer;
}
.child {
height: 100%;
width: 100%;
background-size: cover;
background-repeat: no-repeat;
-webkit-transition: all .5s;
-moz-transition: all .5s;
-o-transition: all .5s;
transition: all .5s;
}
/* Several different images */
.bg-one {background-image: url(https://media.timeout.com/images/101602611/image.jpg);}
.bg-two {background-image: url(http://s1.it.atcdn.net/wp-content/uploads/2015/08/2-London.jpg);}
.bg-three {background-image: url(https://media.timeout.com/images/101484105/image.jpg);}
.bg-four {background-image: url(https://upload.wikimedia.org/wikipedia/commons/thumb/0/00/Hollywood_Sign.jpg/1280px-Hollywood_Sign.jpg);}
.bg-five {background-image: url(http://www.travelandleisure.com/sites/default/files/styles/tnl_redesign_article_landing_page/public/1453920892/DUBAI-554088081-ABOVE0116.jpg?itok=dcoZnCrc);}
.bg-six {background-image: url(http://blog.whitepages.com/wp-content/uploads/2015/04/san-franc.jpg);}
a {
display: none;
font-size: 35px;
color: #ffffff !important;
font-family: sans-serif;
text-align: center;
margin: auto;
position: absolute;
top: 0;
left: 0;
bottom: 0;
right: 0;
height: 50px;
cursor: pointer;
/*text-decoration: none;*/
}
.parent:hover .child, .parent:focus .child {
-ms-transform: scale(1.2);
-moz-transform: scale(1.2);
-webkit-transform: scale(1.2);
-o-transform: scale(1.2);
transform: scale(1.2);
}
.parent:hover .child:before, .parent:focus .child:before {
display: block;
}
.parent:hover a, .parent:focus a {
display: block;
}
.child:before {
content: "";
display: none;
height: 100%;
width: 100%;
position: absolute;
top: 0;
left: 0;
background-color: rgba(52,73,94,0.75);
}
/* Media Queries */
#media screen and (max-width: 960px) {
.parent {width: 100%; margin: 20px 0px}
.wrapper {padding: 20px 20px;}
}
.hello {display: none}
You will try this using that code when you hover the image then it will be zoom out the image. I think it will help you.