SitePoint Sponsor

User Tag List

Results 1 to 5 of 5
  1. #1
    SitePoint Guru
    Join Date
    Jul 2003
    Location
    england
    Posts
    823
    Mentioned
    1 Post(s)
    Tagged
    0 Thread(s)

    Question Indent First Line in Paragraph w/PHP

    I have a pickle: I've been trying to indent the first line in each paragraph after PHP calls it from a database. I get the paragraphs on new lines, as needed, but the first line will not indent. I've uses CSS, to no avail.

    Here is the script I'm using:
    <p class="indent">
    PHP Code:
    echo nl2br($row_getSandF['colt_start_desc']); > 
    </p>

    Here's the CSS:
    #maincontent p.indent {
    text-indent: 5px;
    }

    Is there anything that I can use is conjunction with nl2br in order for the first lines in every paragraph to indent?

    I love this forum...it's like second family.
    Heather

  2. #2
    SitePoint Evangelist
    Join Date
    Aug 2005
    Posts
    453
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Change your css to read :
    HTML Code:
    p.indent {text-indent: 5px;} 
    Computers and Fire ...
    In the hands of the inexperienced or uneducated,
    the results can be disastrous.
    While the professional can tame, master even conquer.

  3. #3
    SitePoint Guru
    Join Date
    Jul 2003
    Location
    england
    Posts
    823
    Mentioned
    1 Post(s)
    Tagged
    0 Thread(s)
    No difference. The first paragraph indented, but the other paragraphs within the document did not (and I need them to). Any other solutions?

    Heather

    Quote Originally Posted by byron3@earthlink View Post
    Change your css to read :
    HTML Code:
    p.indent {text-indent: 5px;} 

  4. #4
    SitePoint Evangelist
    Join Date
    Aug 2005
    Posts
    453
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    If the css works for one, it will work for all. To apply you might have to explode the text on the "<p>" tag and then implode it with "<p class="indent">
    Computers and Fire ...
    In the hands of the inexperienced or uneducated,
    the results can be disastrous.
    While the professional can tame, master even conquer.

  5. #5
    SitePoint Guru
    Join Date
    Jul 2003
    Location
    england
    Posts
    823
    Mentioned
    1 Post(s)
    Tagged
    0 Thread(s)

    Implode and Explode

    I understand what those do, but applying it: I'm stupid in that department.

    Heather

    Quote Originally Posted by byron3@earthlink View Post
    If the css works for one, it will work for all. To apply you might have to explode the text on the "<p>" tag and then implode it with "<p class="indent">


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •