1. Technology

How do I indent the first line in my paragraphs?


Question: How do I indent the first line in my paragraphs?

Indenting paragraphs can be done in several ways.

Cascading Style Sheets

Using CSS, you can set all your paragraphs in a document to be indented whatever amount you would wish.

 p { text-indent : 10px; }

This is the best way to indent paragraphs, as it separates style from content and is widely supported on modern browsers.

Non-Breaking Space

The non-breaking space special character can be used to move text and images over slightly on a Web page.

 & nbsp; & nbsp; & nbsp; & nbsp; Paragraph starts here....

Remove the spaces between the ampersand and the "nbsp;".

Some browsers don't like multiple non-breaking spaces in a row. They will crash, or just ignore them.

Transparent Image

Use a transparent GIF image, no more than 5-10 pixels wide and 2-5 pixels high. Place that image at the beginning of each of your paragraphs.

 <img src="spacer.gif" width="1" height="1" border="0" style="margin: 0 5px 0 5px;" alt=" " />Paragraph starts here....

Using this method can make your pages load more slowly, and look strange if the image doesn't load for some reason.

©2014 About.com. All rights reserved.