<html> <head> <style> body { margin: 0; } #container { display: flex; flex-direction: column; border: 10px solid lime; width: 80px; height: 80px; background-color: red; } #item { background-color: lime; min-height: 0; width: 80px; height: auto; line-height: 80px; } </style> </head> <body> <div id="container"> <div id="item"> </div> </div> </body> </html>