JSFiddle - React, Tailwind, and code Playground

HTML

<div id="content" class="expand">With an height, it's ok</div>

CSS

#content {    
    height: 20px;
    width:400px;
    background-color:#F30;
    transition-duration:2s;    
}

#content.expand {
    height: 300px;
    transition-duration:280ms;
}

JavaScript

function chk()
{
    var node = document.getElementById('content');
    node.classList.toggle('expand');
}

chk();