1. Computing

Discuss in my forum

How do I indent the first line in my paragraphs?

By

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

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.

 <style>
 <!--
 p { text-indent : 10px; }
 -->
 </style> 

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.

 <p>
 & nbsp; & nbsp; & nbsp; & nbsp; Paragraph starts here....
 </p> 

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.

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

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

  1. About.com
  2. Computing
  3. Web Design / HTML
  4. About.com Web Design A to Z
  5. FAQs
  6. How do I indent the first line in my paragraphs?

©2014 About.com. All rights reserved.