Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

indent second line of paragraph

Status
Not open for further replies.

ksbigfoot

Programmer
Apr 15, 2002
856
0
0
CA
Is there a way with CSS to have every line after the first line indented.

Eg.)

This is my first line that I want to
show. This is the rest of the
paragraph that I am trying to display
 
that ones easy m8:

Code:
p
{
    margin-left: 20px;
}

p:first-line
{
    margin-left: 0px;
}

this will apply to all p tags
 
Howdy Andeee,

I tried what you suggested and it seems to be indenting the whole paragraph, Could you look at what I am doing wrong.
Thanks
Code:
<html>
<head>
  <title>Untitled</title>
<style type="text/css">
p { margin-left: 40px; }
p:first-line { margin-left: 0px; }
</style>
</head>

<body>
<p>This is a test, only a test.  Not what I would of thought of. Do not try this without supervision of a professional.Do not try this without supervision of a professional.Do not try this without supervision of a professional.Do not try this without supervision of a professional.Do not try this without supervision of a professional.Do not try this without supervision of a professional.Do not try this without supervision of a professional.</p>
</body>
</html>
 
Sure, you can use first-line and have problems in IE and some other browsers that don't support this. And create extra code that is clearly not needed. Or, you could go with text-indent, which was designed to do just that.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top