Text Links Ads : Marketing Tips Store : Search Engine Optimization Strategies
WebPosition Gold Pro : Domain Registration Bank : Optilink Software : GoDefy
Mike's Marketing Tools : Mike's Ecommerce Software : Text Links Guide
 
Web HTML-HTML.com
You are here: HTML Codes > Lines and Paragraphs > Indenting

Indenting the First Line of Each Paragraph

To indent the first line of each paragraph set a style rule using text-indent. For example, the following code indents the first line of each paragraph 30 points. Copy this code into the <HEAD> section of your page:

<STYLE TYPE="text/css">
<!--
P {text-indent: 30pt;}
-->
</STYLE>

This code indents the first line of each <P ...> element, but you'll probably run into an annoying problem. If you're like most designers you probably don't put a P before the first paragraph or between a header like <H1 ...> and the text that follows it. Unfortunately, that's exactly what you'll need to do if you want the paragraph indented. The text in these situations is part of something called "anonymous blocks" and cannot be referred to directly. To indent it you must put the text in a <P ...> element.

So, for example, the following code does not have a <P ...> between the header and the text, so the text is not indented:

<H1>My Story</H1>
This paragraph is not indented.

which gives us

My Story

This paragraph is not indented.

This code does have a <P ...> between the header and the text, so the text is indented:

<H1>My Story</H1>
<P>
This paragraph is indented.

My Story

This paragraph is indented.

<P ...> >>>

Copyright © 2002-8 Art Dacor USA LLC. All Rights Reserved.
3727 West Magnolia Blvd #489, Burbank, CA, 91505, USA.
www.HTML-HTML.com