-2

How can I force the following HTML code:

<p><span></span></p>

.. to use vertical space? if the span has a character, or a space, the vertical space is occupied.

Any way to do it with CSS?

oscarm
  • 2,630
  • 6
  • 41
  • 74

2 Answers2

4

You could do:

p span { display: block; height: 1em; }

However, you should put a class on that span, so it doesn't affect everything else.

EDIT: inline-block would probably be better.

Andrew Vit
  • 18,961
  • 6
  • 77
  • 84
0

You can set min-height on the paragraph:

p { min-height:1.3em; }

However, IE6 does not support the min-height property... I don't have older versions of IE here, so I cannot test this but in modern browsers min-height works just fine. The value 1.3em represents the height of one line of text.

Šime Vidas
  • 182,163
  • 62
  • 281
  • 385