I have a box in CSS with fixed dimensions, enough to fit any of my texts. I don't want white space between the end of the text and the bottom box border. How can I fit them into the boxes? Something like expanding the line-height to fit.
Height is the vertical measurement of the container, for example, height of a div. Line-height is a CSS property to specify the line height i.e. the distance from the top of the first line of text to the top of the second. It is the space between the lines of two paragraphs.
Desktop browsers (including Firefox) use a default value of roughly 1.2 , depending on the element's font-family . The used value is this unitless <number> multiplied by the element's own font size.
For the optimal readability and accessibility, you should go with140 – 180% line height (this is the space around a line of text). This means if your font size is 16pt, your line height should be at least 16 x 1.4 = 22.4pt (140%), or 16 x1. 8= 28.8pt (180%) maximum value.
line-height: normal;
Is correct.
Try vertical-align:bottom
.
If that doesn't work, you can try line-height: 1em
If that still doesn't do what you want, you'll have to clarify further what you're trying to achieve.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With