Is there a way to set min-line-height on inline element in CSS?

后端 未结 3 1952
滥情空心
滥情空心 2021-01-17 19:12

I have some inline links with icon showing on the left (padding + bacground), but when the font is too small, the image doesn\'t fit in line height and gets cropped on top a

3条回答
  •  予麋鹿
    予麋鹿 (楼主)
    2021-01-17 20:02

    You can use min() or max() to create minimum/maximum values on most css properties.

    Here is an example that sets the line-height at 10vh or 100px. Whichever one is smallest will be used in the browser. If you use max() it will select whichever property is largest.

    line-height: min(10vh, 100px);
    
              // or //
    
    line-height: max(10vh, 100px);
    

    See min() and max().

提交回复
热议问题