【问题标题】:Remove space above and below the text inside the <a> tag删除 <a> 标记内文本上方和下方的空格
【发布时间】:2014-03-14 18:02:56
【问题描述】:

您会在下面看到带有浅蓝色背景的&lt;a&gt; 标签的打印屏幕。

如您所见,&lt;a&gt; 标签内的文本上下都有空格。

是否可以删除文本周围的空间?

亲切的问候

【问题讨论】:

标签: html css vertical-alignment


【解决方案1】:

你需要更小的行高。

【讨论】:

    【解决方案2】:

    也许你可以...

    选项 1:

    a {
        padding: 0; /* This will probably work A.F.A.I.K. */
        display: inline-block;
        /* If it doesn't, adding inline-block display will it inline **and** have
        a CSS box... but I'm not sure if this is recommended, honestly. */
    }
    

    选项 2:

    a {
        line-height: 0;
        /* Mess with the line-height value to change the
        "Line Height" in an inline element */
    }
    

    【讨论】:

      【解决方案3】:

      基本上&lt;a&gt; 标签没有这样的填充。告诉我,这个标签是否在任何 &lt;li&gt; 标签或其他任何东西中。

      【讨论】: