Embedded padding/margin in fonts

后端 未结 16 1275
执念已碎
执念已碎 2021-01-08 00:56

It seems that all fonts have some sort of embedded padding or margin. By setting:

margin: 0px;
padding: 0px;

You never get what you want. D

16条回答
  •  盖世英雄少女心
    2021-01-08 01:20

    After looking at the html source of a html document found out that after the normal margin/padding added by all the browsers, chrome by default adds its own webkit's margin/padding properties.

    -webkit-margin-before: 1em;
    -webkit-margin-after: 1em;
    -webkit-margin-start: 0px;
    -webkit-margin-end: 0px;
    

    Solution is instead of normal

    *{
    margin:0;
    padding:0;
    }
    

    Append the style with

    *{
    margin:0;
    padding:0;
    -webkit-margin-before:0;    
    -webkit-margin-after:0;
    }
    

    As -webkit-margin-start and -webkit-margin-end are already set to 0px, there is no use of setting them in here.

    Tell me if that works! :)

提交回复
热议问题