<div id="app">
<transition name="card" mode="out-in">
<div class="card" v-if="front == true" key="front">
<h2>Sign In</h2>
<div class="form">
<h1>Sign In Form</h1>
</div>
<div class="footer">
<span>Not a member?</span>
<button @click="front = false">
Join Us
</button>
</div>
</div>
<div class="card" v-else key="back">
<h2>Sign Up</h2>
<div class="form">
<h1>Sign Up Form</h1>
</div>
<div class="footer">
<span>Already a member?</span>
<button @click="front = true">
Log In
</button>
</div>
</div>
</transition>
</div>
#app {
display: flex;
justify-content: center;
}
.card {
width: 300px;
height: 210px;
background-color: orange;
text-align: center;
}
h1, h2 {
color: white;
}
h2 {
background-color: blue;
margin-top: 0;
}
.form {
width: 270px;
height: 120px;
background-color: green;
margin: auto;
display: flex;
justify-content: center;
align-items: center;
}
.footer {
margin-top: 10px;
margin-right: 15px;
text-align: right;
}
.card-enter,
.card-leave-to {
opacity: 0;
transform: rotateY(90deg);
}
.card-enter-active,
.card-leave-active {
transition: all 0.5s;
}
new Vue({
el: '#app',
data: {
front: true
}
})
This Pen doesn't use any external CSS resources.