html – Indenting only the first line of text in a paragraph?

html – Indenting only the first line of text in a paragraph?

Use the text-indent property.

p { 
   text-indent: 30px;
}

jsFiddle.

In addition to text-indent, you can use the :first-line selector if you wish to apply additional styles.

p:first-line {
    color:red;
}

p {
    text-indent:40px;
}

http://jsfiddle.net/Madmartigan/d4aCA/1/

html – Indenting only the first line of text in a paragraph?

Very simple using css:

p {
    text-indent:10px;
}

Will create an indentation of 10 pixels in every paragraph.

Leave a Reply

Your email address will not be published.