I'm trying to make an Accordion Menu by setting the max-height of the content to zero and then give it a value when a radio button is checked but when I set the max-height to 0 it creates additional space below the tab
this additional space is removed by replacing max-height with height so why does that happen and what is the difference between the two properties ?
HTML:
<div class="tab-group">
<div class="tab">
<input type="radio" name="tab" id="first-tab"><!--/radio-->
<label for="first-tab">First Tab</label><!--/label-->
<div class="tab-content">
<p>
Lorem ipsum dolor sit amet
</p>
</div><!--/content-->
</div><!--/.tab-->
<div class="tab">
<input type="radio" name="tab" id="second-tab"><!--/radio-->
<label for="second-tab">Second Tab</label><!--/label-->
<div class="tab-content">
<p>
Lorem ipsum dolor sit amet
</p>
</div><!--/content-->
</div><!--/.tab-->
</div><!--/.tab-group-->
CSS:
.tab-content {
max-height: 0;
overflow: hidden;
transition: max-height .5s linear;
}
input[type="radio"]:checked ~ .tab-content {
max-height: 10em;
}