提问者:小点点

强制更窄的行高


我有这行HTML:

null

<div style=''line-height: 0.75em;min-height: 0.75em;''>&nbsp;</div>

null

结果是一条与文档中所有其他行高度相同的行。

我如何修改这个代码,使空白行是所有其他行高度的75%?


共1个答案

匿名用户

您应该删除其中一组单引号。

这个:

<div style=''line-height: 0.75em;min-height: 0.75em;''>&nbsp;</div>

应该是:

<div style='line-height: 0.75em;min-height: 0.75em;'>&nbsp;</div>

null

<div>Sample line 1</div>
<div style='line-height: 0.5em;min-height: 0.5em;'>&nbsp;</div>
<div>Sample line 2</div>
<!-- change the line-height and min-height values to see the blank line height change. -->
<!-- Also use 2 sets of single quotes to see that this results in the style attributes being ignored. -->