SitePoint Sponsor

User Tag List

Results 1 to 6 of 6
  1. #1
    SitePoint Addict Huscy's Avatar
    Join Date
    Jul 2002
    Location
    Newcastle, UK
    Posts
    318
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Code indentation classes...

    ok, i am trying to indent my code in a tutorial, and while using margin-left: 10px; works, it only seems to work if i use <p> or <div> - my question is can i do this with <span> - because i dont want to force a line break each time it indents (which happens with <p> and <div>) i just want to indent say 3 lines to 10px, then a few more at 20px, etc.

    any help?

  2. #2
    ☆★☆★ silver trophy vgarcia's Avatar
    Join Date
    Jan 2002
    Location
    in transition
    Posts
    21,235
    Mentioned
    1 Post(s)
    Tagged
    1 Thread(s)
    margin-left should work with <span> tags. I've never had problems with it.

  3. #3
    SitePoint Wizard Bill Posters's Avatar
    Join Date
    Dec 2001
    Location
    UK
    Posts
    1,523
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    It would be worth your while to take a look at the <pre> tag.

    It will help you to copy/paste your preformatted code directly into the html doc and keep all the spacing and tabulation intact.
    New Plastic Arts: Visual Communication | DesignateOnline

    Mate went to NY and all he got me was this lousy signature

  4. #4
    The CSS Clinic is open silver trophybronze trophy
    Paul O'B's Avatar
    Join Date
    Jan 2003
    Location
    Hampshire UK
    Posts
    40,475
    Mentioned
    182 Post(s)
    Tagged
    6 Thread(s)
    Quote Originally Posted by vgarcia
    margin-left should work with <span> tags. I've never had problems with it
    Won't that just give a left margin to the first word of the sentence as it is an inline tag? Any subsequent lines in the span would not have any left margin.

    Paul

  5. #5
    ☆★☆★ silver trophy vgarcia's Avatar
    Join Date
    Jan 2002
    Location
    in transition
    Posts
    21,235
    Mentioned
    1 Post(s)
    Tagged
    1 Thread(s)
    Quote Originally Posted by Paul O'B
    Won't that just give a left margin to the first word of the sentence as it is an inline tag? Any subsequent lines in the span would not have any left margin.

    Paul
    That's what text-indent does to <p> tags, and after a quick test, I find that in fact, you are correct about <span>s as well.

    It looks like Bill Posters' suggestion is best. Use the <pre> tag.

  6. #6
    SitePoint Addict Huscy's Avatar
    Join Date
    Jul 2002
    Location
    Newcastle, UK
    Posts
    318
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    thanks <pre> works nicely


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
  •