By default, line items expand based on their children. So your problem is not in the .row class, but in #rect
In the direct element, you have the line height 1.4 by default bootstrap css. Make it a class, not an id.
You can reduce it to 1.2 for your case ... Do this in a separate css file and overwrite it. That would be best for you.
.rect { line-height: 1.2;
source share