When you make the .txt
element inline-block
, it is taken into the text flow of the parent .btn
element. At that point, the line-height of .btn
kicks in, which is larger than the height of the .txt
element.
So, add .btn {line-height: 10px;}
(for example) and your problem is fixed. I saw you already tried to influence the line-height of the inner .txt
element, so you were pretty close with your attempts. Adjusting the font-size would work as well, since the default line-height is formula-based on the font-size. Anyway, the key is to do that on the parent element, not the child element.
You don't have this problem when you make the inner element a block
, because then there's no text-like content, so there's no line-height applied at all.
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…