I have a portfolio type 3 columned layout. Every portfolio item is a div containing name of the project and a little brief. Project name is displayed first and when I hover over the div, the div flips and the brief is shown then.
When I hover over the div, brief is overflowing from top left. I want both the project name and brief to be placed in the dead center of the div. Below is the snippet code.
.flip-container {
perspective: 1000;
margin-right: 30px;
background-color: red;
margin-bottom: 20px;
}
/* flip the pane when hovered */
.flip-container:hover .flipper,
.flip-container.hover .flipper {
transform: rotateY(180deg);
}
.flip-container,
.front,
.back {
width: 360px;
height: 320px;
}
/* flip speed goes here */
.flipper {
transition: 0.6s;
transform-style: preserve-3d;
position: relative;
}
/* hide back of pane during swap */
.front,
.back {
backface-visibility: hidden;
position: absolute;
text-align: center;
/*top: 0;
left: 0;*/
}
/* front pane, placed above back */
.front {
z-index: 2;
/* for firefox 31 */
transform: rotateY(0deg);
}
/* back, initially hidden pane */
.back {
transform: rotateY(180deg);
}
<div class="row">
<div class="flip-container col-md-4 portfolio-item" ontouchstart="this.classList.toggle('hover');">
<div class="flipper">
<div class="front">
<!-- front content -->
<h3>
<a href="#">Project Name</a>
</h3>
</div>
<div class="back">
<!-- back content -->
<p>Lorem ipsum dolor sit amet, consectetur adipiscing elit. Nam viverra euismod odio, gravida pellentesque urna varius vitae.</p>
</div>
</div>
</div>
<div class="flip-container col-md-4 portfolio-item" ontouchstart="this.classList.toggle('hover');">
<div class="flipper">
<div class="front">
<!-- front content -->
<h3>
<a href="#">Project Name</a>
</h3>
</div>
<div class="back">
<!-- back content -->
<p>Lorem ipsum dolor sit amet, consectetur adipiscing elit. Nam viverra euismod odio, gravida pellentesque urna varius vitae.</p>
</div>
</div>
</div>