How to Reduce the Spacing Between Lines in HTML

Techwalla may earn compensation through affiliate links in this story. Learn more about our affiliate and product review process here.
You can reduce the spacing between lines directly within a web page's HTML file.

Using HTML makes it easy to create basic web pages and to control various attributes of these pages, including font, text size, color and line spacing. Reducing the spacing between lines can be useful if you need to condense a web page or to reduce white space for aesthetic reasons. Fortunately, reducing the spacing between lines is simply a matter of making a few quick insertions in the page's HTML file.

Advertisement

Step 1

Identify the section of your HTML document that corresponds to the portion of your web page for which you'd like to decrease the spacing between lines.

Video of the Day

Step 2

Enclose that section of the document in a "

" tag. A "
" tag, also known as a divide tag, marks a section of HTML that you'd like to apply a certain style to. Insert "
" at the beginning of the section and "
" at the end of the section.

Advertisement

Step 3

Insert "style=" within the first "

" tag as follows: <div style=>. The "style" operator signals to the browser rendering the web page that it should style the portion of the page enclosed in the divide tags in a specific way that is distinct from the rest of the web page.

Advertisement

Step 4

Place the text "line-height:" within quotes after the style operator as follows:

. Be sure to include a colon after the text. The "line-height" attribute signals to the browser that it should modify the spacing between the lines for the portion of the page enclosed in the divide tags.

Advertisement

Advertisement

Step 5

Insert a number followed by the percentage sign after the colon following the "line-height" attribute, as follows:

. The number you insert is your desired line spacing expressed as a percentage of the page's current line spacing. For example, if you insert 50, the spacing between the lines will be half its current spacing, while if you insert 200, the spacing will be double its current spacing. Insert any number less than 100 to reduce the spacing between the lines in the section enclosed by the divide tags.

Step 6

Save your HTML document and test it by opening it in a web browser to see how it will appear to readers accessing it through the Internet.

Video of the Day

Advertisement

Advertisement

references & resources