I want to make a transition of height in CSS, but I noticed that I have to adjust the height statically so that it works.
Here is my code working with static height:
<!-- HTML --->
<div class="content show">
<form method="post" action="">
<label>Lastname
<input type="text" name="lastname">
</label>
<label>Firstname
<input type="text" name="firstname">
</label>
</form>
</div>
/* CSS */
.content{
overflow:hidden;
}
.content.show{
height:433px !important; <<--------- //I would not define this height
transition:0.5s;
-webkit-transform:translateY(0);
}
.content.hidden{
height:60px;
transition:0.5s;
-webkit-transform:translateY(0);
}
Here is the code I want to be with an automatic height:
<!-- HTML --->
<div class="content show">
<form method="post" action="">
<label>Lastname
<input type="text" name="lastname">
</label>
<label>Firstname
<input type="text" name="firstname">
</label>
</form>
</div>
/* CSS */
.content{
overflow:hidden;
}
.content.show{
height:auto !important; <<<----------
transition:0.5s;
-webkit-transform:translateY(0);
}
.content.hidden{
height:60px;
transition:0.5s;
-webkit-transform:translateY(0);
}
Someone would have an idea how to run this code? I specify that I do not want to use javascript.