How can I remove the vertical blank space from the top and bottom of this element? The text and text size are dynamic so I can't hard code a value in the css.
Thanks
You need to set the line-height smaller than the font-size. So if you have football declared in size 50px font, set the line-height to 40px. It will account for the spacing above and below the font chars.
p {
font-size: 50px;
background-color: red;
line-height: 40px;}
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.