Indent all but first line

Posted on 2002-05-03
Last Modified: 2008-03-17
Is it possible to indent all but the first line using CSS in a SPAN?  It would look somewhat like a list, but not bulleted.  For example, I want it to look something like this:

Line 1
   Line 2
   Line 3
   Line 4

Question by:ten_spoons
LVL 53

Expert Comment

ID: 6989101
Yes, but not with a span.  it can only be applied the block elements.  works bes with the p tag:

<p> first line of text</p>
<p style="text-indent:10px">
the rest of the stuff goes here
You cannot use a br tag within the indented text, that will end indentation

The problem with it is that yu ge and extra line feed between the pargraphs.
If you don't want that you can try it with a span this way this way:
<p>first line here<br/>
<span style="padding-left:10px">
all the rest of the stuff here

The problem with the second method is that it is unreliable for Netscrap 4, and some version of Opera
LVL 51

Expert Comment

ID: 6989172
<head><style TYPE="text/css"> p:first-line  {margin-left:-20px;} p {margin-left:50px;} </style></head>
<body><p>line 1<br>line 2<br>line 3<br></p></body>
LVL 53

Expert Comment

ID: 6989310
Yes first-line will work but only for ie5.5+, Netscrap6, and I think probably Opera.

Free Tool: SSL Checker

Scans your site and returns information about your SSL implementation and certificate. Helpful for debugging and validating your SSL configuration.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

LVL 51

Expert Comment

ID: 6989587
well, when talking about CSS, I'd use NS6, Opera 4.x, 5.x, 6.x, and probably IE6.x, (not shure about amaya, mozilla and Konqueror 3.x) Anything else is wasting time ...
(Cd&, think you already know this, 'cause I've seen you posting this sevaral time:-)

Accepted Solution

TenTonJim earned 100 total points
ID: 6991474

Author Comment

ID: 6994752
Thank you everybody for the suggestions.  TenTonJim's just worked best for the situation.

Featured Post

Free Tool: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

CSS3 Custom checkboxes This article shows how to style the checkbox form element using only CSS. Works in: Chrome, FF, Safari, Opera, IE9+ Uses modernizr.js to check for :checked pseudo class, falling back to plain old checkboxes (IE8 and bel…
Styling your websites can become very complex. Here I'll show how SASS can help you better organize, maintain and reuse your CSS code.
In this Micro Tutorial viewers will learn how to create a CSS image sprite (In a later tutorial, viewers will learn how to use CSS and HTML to create a navigation menu using this sprite) Open a new Photoshop document with a width of (Icon width)x(N…
In this tutorial viewers will learn how to style a decorative dropcap for the first letter in a paragraph using CSS. In CSS, create a new paragraph class by typing "p.fancy": Then, to style only the first letter of the first sentence, include the ps…

856 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question