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.
You can reduce the spacing between lines directly within a web page's HTML file.
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.
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.
Insert "style=" within the first "
" tag as follows:
. 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.
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.
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.
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.
Get great tech advice delivered to your inbox.
Keep your family productive, connected, entertained, and safe.