Two classes can be used. One for the folded state:
div.collapsed {
height: 50px;
overflow: hidden;
}
Another for advanced state:
div.expanded {
min-height: 50px;
}
If you move the mouse over the DIV, delete the collapsed class and add the extended class.
The trick is to remove the explicitly specified height and use min-height: it will expand the long text well, but will not affect the short text. Thus, you do not need to distinguish between cases with overflow and without it.
source
share