How can I remove top and bottom spaces from text in HTML?
Currently, the only approach I have found online is using the CSS property ‘line-height’. In the backend, I am using C# to obtain the font’s height through ‘GlyphTypeface.CapsHeight’ and adjust the CSS ‘line-height’ accordingly.
style = $"line-height: {font.CapsHeight}em;"
I want to achieve a similar text style to that of Photoshop, as shown in the attached image.
Left side is HTML and right side is Photoshop Text
Are there any alternative methods to remove top space, or other ways to achieve text formatting similar to the image without spaces?
2
Answers
To remove unwanted spacing around text in HTML, you can use the CSS padding properties or by using bootstrap class.
To remove the margin around an element, you can
"style:padding=0"
mx-auto
orpx-px-auto
to the div class of the texthere’s what you want
Remove white space above and below large text in an inline-block element
Remove white space above and below large text in an inline-block element