Skip to content Skip to sidebar Skip to footer

How Can I Use Line-height Without Affecting Caret Height?

In a contenteditable div I'm using line-height to add some line space when I have multiple lines. This is a sample div showing the issue:
Copy
<div contenteditable="true">
  line height line height line height
  <span>line height</span>
  <span>line height</span>
  <span>line height</span>
  <span>line height</span>
</div>

Solution 2:

Try using padding instead of line-height and change display to inline-block:

<span style="padding: 10px 0; display: inline-block;">padding</span>

Post a Comment for "How Can I Use Line-height Without Affecting Caret Height?"