Welcome to the Treehouse Community
Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.
Looking to learn something new?
Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.
Start your free trial
Riin A.
14,431 PointsCSS transition and positioning with float
Hello
I have a problem wiht CSS transitions. I have basically two boxes that I want to be next to each other. Since I want both of them to be next to each other I thought it should be easy- one float to left and other to right... but it does not work. I even but one extra <div class="box"> so parent will be relative... but still it does not work. I have also tried to position these boxes like left:0px and right:0px but still does not work..
I Will copy my HTML:
<div class="box">
<div class=" wrap">
<div class="front">1</div>
<div class="back"> 2 </div>
</div>
<div class="wrap1">
<div class="front1"> 3</div>
<div class="back1">4</div>
</div>
</div>
And here is CSS
.wrap {
position: relative;
transition: -webkit-transform 0.9s ease-in;
-webkit-transform-style: preserve-3d;
max-width: 50%;
height: 460px;
margin: 1% 0% 1% 0;
cursor: pointer;
}
.wrap div {
width: 100%;
height: 100%;
position: absolute;
-webkit-backface-visibility: hidden;
text-align: center;
}
.front{
z-index: 100;
background: #E5C800;
color:white;
font-size: 540%;
text-align: 50% 50%;
}
.back {
-webkit-transform: rotateY(-180deg);
background: none;
border: 15px solid #E5C800;
}
.wrap:hover {-webkit-transform: rotateY(-180deg);}
/*** second box ->> right ***/
.wrap1 {
position: relative;
transition: -webkit-transform 0.9s ease-in;
-webkit-transform-style: preserve-3d;
max-width: 41%;
height: 460px;
margin: 1% 0% 1% 0;
cursor: pointer;
}
.wrap1 div {
width: 100%;
height: 100%;
position: absolute;
-webkit-backface-visibility: hidden;
text-align: center;
box-shadow: inset 0 0 45px rgba(255,255,255,.3), 0 12px 20px -10px rgba(0,0,0,.4);
}
.front1{
z-index: 100;
background: #BF00E3;
color: white;
font-size: 440%;
}
.back1 {
-webkit-transform: rotateY(-180deg);
background: none;
border: 15px solid #BF00E3;
margin: 1% 0 1% 1%;
}
.wrap1:hover {-webkit-transform: rotateY(-180deg);}
Thanks everybody in advance!