No Space Between Paragraph?

Discussion in 'CSS' started by gobbly2100, Sep 21, 2007.

  1. #1
    Hey all,

    I would like to make 2 lines of text right underneath eachother but don't know how to stop the space it makes between the 2 paragraphs.

    Any help on this would be much appreciated, thanks!
     
    gobbly2100, Sep 21, 2007 IP
  2. Jamie18

    Jamie18 Peon

    Messages:
    201
    Likes Received:
    3
    Best Answers:
    0
    Trophy Points:
    0
    #2
    set
    padding-top: 0;
    padding-bottom: 0;

    for all paragraphs in question..

    if that doesn't work.. try margin-top and margin-bottom as well
     
    Jamie18, Sep 21, 2007 IP
  3. Stomme poes

    Stomme poes Peon

    Messages:
    3,195
    Likes Received:
    136
    Best Answers:
    0
    Trophy Points:
    0
    #3
    Is it possible to simple not have </p><p> tags in between?

    <p>This sentence will be right next to the one under it because there will be no end tag until after both of the sentences are completely finished (depending on your browser size I guess). Here is the second sentence which is also wrapping to directly underneath the first one (also depending on your browser size).</p>

    Otherwise
    <p>This is one sentence.</p>
    <p>This is another one and will have space in between them, which is automatic with </p>.

    <p> is a block element and depending on your situation, you could also use <span> which will wrap without newline. Or maybe some other element is more appropriate.

    Moving the padding and margins of each paragraph/sentence is a possibility but this means you have to either give a class to each <p> (unless you want this for the whole site). You could even do simpler than what Jamie said if you give the bottom <p> a negative top margin (to compensate for the above <p>s bottom margin).
     
    Stomme poes, Sep 21, 2007 IP
  4. meetgs

    meetgs Active Member

    Messages:
    957
    Likes Received:
    35
    Best Answers:
    0
    Trophy Points:
    70
    #4
    use <div>
    there will be no spaces between each DIV
     
    meetgs, Sep 21, 2007 IP
  5. Dalia

    Dalia Peon

    Messages:
    38
    Likes Received:
    1
    Best Answers:
    0
    Trophy Points:
    0
    #5
    you can use <p></p> or <br>
     
    Dalia, Sep 21, 2007 IP
  6. soulscratch

    soulscratch Well-Known Member

    Messages:
    964
    Likes Received:
    45
    Best Answers:
    0
    Trophy Points:
    155
    #6
    -_-

    Reset the first paragraph's bottom padding+margin and the second paragraph's top padding+margin.
     
    soulscratch, Sep 21, 2007 IP
  7. Websworth

    Websworth Peon

    Messages:
    50
    Likes Received:
    1
    Best Answers:
    0
    Trophy Points:
    0
    #7
    If you use:

    * {
    margin: 0;
    padding: 0;
    }

    That will reset all properties with margin and padding to 0 then you can just apply the amount of padding you need for elements individually. i.e

    #container p {
    margin-bottom: 10px
    }

    This way you can have all the <p>'s with no spacing but anything within the container div with look like regular paragraphs
     
    Websworth, Sep 22, 2007 IP
  8. soulscratch

    soulscratch Well-Known Member

    Messages:
    964
    Likes Received:
    45
    Best Answers:
    0
    Trophy Points:
    155
    #8
    I like to have the uni-reset (as I call it) on a single line.. and include the font size so it's more consistent when alt tabbin through browsers since they have different default font sizes, etc.

    *{margin:0;padding:0;font-size:100.01%;}

    And almost always use shorthand for margin/padding .. #container p { margin:0 0 1em; }
     
    soulscratch, Sep 22, 2007 IP