Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to increase spacing between lines in CSS?

Tags:

html

css

I have something similar to that:

<table>
    <tr>
        <td>Hello,<br/>World!</td>
    </tr>
</table>

Both lines

Hello,
World!

are displayed too close to one another. Any way to increase spacing between them (by a portion of a line width (without another <br/>))?

like image 682
User Avatar asked Jul 11 '09 17:07

User


People also ask

How do you add 1.5 spacing in HTML?

Those who need the line spacing to be set to 1.5 should use line-height: 1.5 . And if you want the spacing to return to its original value (before you messed with it), use line-height: normal .

How do I increase the space between lines in HTML?

To create extra spaces before, after, or in-between your text, use the &nbsp; (non-breaking space) extended HTML character. For example, with the phrasing "extra space" using a double space, we have the following code in our HTML.

How do you add paragraph spacing in CSS?

As in print layout programs, you can add space between paragraphs using margin-bottom or margin-top in your CSS, used below in the paragraph element. Compare the difference between the one without extra space (below, left) to the one with the added margin-bottom between paragraphs (below, right).

What is line spacing CSS?

The line-height CSS property defines the space between two inline elements. The typical use is, to space-out text. You can see people comparing it to 'leading' which is a term used in typography that refers to the space between the baseline of two lines of text.


2 Answers

Here's a full example of how to make the line spacing within <td>s one and a half times the height of the font:

<html><head>
<style>
td {
    line-height: 150%;
}
</style>
</head>
<body>
<table>
    <tr>
        <td>Hello,<br/>World!</td>
    </tr>
</table>
</body></html>
like image 164
RichieHindle Avatar answered Oct 03 '22 05:10

RichieHindle


Use line-height to adjust the, well, line height. So in your case line-height: 2 will double the line height.

like image 38
Gumbo Avatar answered Oct 03 '22 06:10

Gumbo