How can I remove the space between a character in HTML? Padding doesn't work

懵懂的女人 提交于 2019-12-07 11:32:07

问题


Why is there space(marked in red color) before the letter 'അ', even if I added padding as 0px?

<span style="margin:0;padding:0;border:1px solid blue;font-size:128px">അ</span>

回答1:


That space is part of the font. Use a negative letter-spacing margin-left on it in order to remove it.

Example

Note: this only moves the entire span a few px back. In reality, the space is still there and cannot be properly removed.




回答2:


In typography, spacing between characters is often adjusted due to esthetic and readability considerations. The spaces are there even in common ascii letters:

<span style="margin:0;padding:0;border:1px solid blue;font-size:128px;letter-spacing:0px;">a</span>

But the space is different because of different variables like what is the previous and next character.

You can achive some results by playing with negative padding and letter-spacing

More info




回答3:


White spaces occur from working with inline positioning and spans are always inline elements. Solution here: https://css-tricks.com/fighting-the-space-between-inline-block-elements/

Have you looked at lettering.js? Its a jquery plug-in that works specifically for typography.



来源:https://stackoverflow.com/questions/10259888/how-can-i-remove-the-space-between-a-character-in-html-padding-doesnt-work

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!