0

我不知道默认字体大小是多少,但无论如何我想将其缩小 2px。

<td style='width:30%; margin:0 5%; text-align:left;vertical-align:top;font-family:Tahoma, Arial, Helvetica;' font-size:'xx'>Some text</td>

分配什么font-size属性以使我的文本小 2 个像素。谢谢。

4

2 回答 2

2

如果你真的想让它2px更小,并且你很乐意接受这只适用于现代浏览器:

font-size: calc(1em - 2px);

参考:

caniuse上的兼容性信息

Mozillaw3c上的文档

于 2013-04-16T17:21:21.463 回答
1

What you want is to use em's instead of pixels. Em's are represented in percentages relative to everything else so

font-size: .8em;

Would make it 80% of the size as the text around it.

See http://www.w3schools.com/cssref/css_units.asp for a good explanation on CSS units.

于 2013-04-16T17:16:02.770 回答