Space in HTML

Discussion in 'HTML & Website Design' started by Orquidea, Mar 6, 2007.

  1. #1
    Hi everyone, how do i put same space at the beginnning of a line, i don't want a new line (so i cann't use br and p tags), i just want the sentence to be a lite be inside)
    thanks
     
    Orquidea, Mar 6, 2007 IP
  2. skimmy

    skimmy Peon

    Messages:
    138
    Likes Received:
    2
    Best Answers:
    0
    Trophy Points:
    0
    #2
      should do the trick if you are just looking for a space.
     
    skimmy, Mar 6, 2007 IP
  3. the_pm

    the_pm Peon

    Messages:
    332
    Likes Received:
    33
    Best Answers:
    0
    Trophy Points:
    0
    #3
    I believe you're looking for the   element, non-breaking space :)

    This is the equivalent of one spacebar press, and you can stack them - browsers will recognize multiple instances.
     
    the_pm, Mar 6, 2007 IP
  4. Orquidea

    Orquidea Peon

    Messages:
    4
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #4
    thank you guys
     
    Orquidea, Mar 6, 2007 IP
  5. kk5st

    kk5st Prominent Member

    Messages:
    3,497
    Likes Received:
    376
    Best Answers:
    29
    Trophy Points:
    335
    #5
    You could use the text-indent property.
    
    p {
        text-indent: 1em;
        }
    Code (markup):
    This will cause the first line of the p element to be indented by the specified amount. I'm not in favor of the non-breaking space for this use, as it mixes presentation with structure and violates the DRY principle. If you decide on a different indention, you must edit every file that has it. With css, you change it once.

    cheers,

    gary
     
    kk5st, Mar 6, 2007 IP
  6. the_pm

    the_pm Peon

    Messages:
    332
    Likes Received:
    33
    Best Answers:
    0
    Trophy Points:
    0
    #6
    Ah, that's the property! I originally tried the following:

    p:first-line { padding-left:1em }

    But browsers didn't much care for that method :)

    Thanks for that Gary.
     
    the_pm, Mar 8, 2007 IP