How To Reduce The Gap Between Each New Paragraph Using CSS?

Discussion in 'CSS' started by bad_bob00, Jun 12, 2009.

  1. #1
    Hi,

    I've got a menu which I've made simply by using paragraphs, for example:

    <p>link 1</p>
    <p>link 2</p>
    etc.


    But I want there to be less spacing between each new line, so the text appears to be closer together. Anyone know how this is done?


    Thanks for any help :)
     
    bad_bob00, Jun 12, 2009 IP
  2. emed

    emed Peon

    Messages:
    70
    Likes Received:
    12
    Best Answers:
    0
    Trophy Points:
    0
    #2
    with css:
    
    #menu p {
    margin-top:0;
    margin-bottom:0;
    }
    
    you can change the 0's for the values you want, for example margin-top:5[B]px[/B]; (dont forget the px)
    
    <div id="menu">
    <p>link 1</p>
    <p>link 2</p>
    </div>
    
    Code (markup):
     
    emed, Jun 12, 2009 IP
    bad_bob00 likes this.
  3. bad_bob00

    bad_bob00 Active Member

    Messages:
    3,472
    Likes Received:
    56
    Best Answers:
    0
    Trophy Points:
    90
    #3
    Thanks very much emed, its sorted now :)
     
    bad_bob00, Jun 12, 2009 IP
  4. babanesma

    babanesma Well-Known Member

    Messages:
    26
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    116
    #4
    You can give to the margin a negative value .
    For example :
    margin-bottom: -2px;
    Code (markup):
     
    babanesma, Jun 12, 2009 IP
  5. justinlorder

    justinlorder Peon

    Messages:
    4,160
    Likes Received:
    61
    Best Answers:
    0
    Trophy Points:
    0
    #5
    Because the default margin value of <p> tag is not zero (in IE and FF),
    if you would like to reduce the gaps of paragraph,
    Just set the margin value manually .

    P {
    margin: 0 1px;
    }
    The first value is for top and bottom margin and the second value is for left and right margin .
     
    justinlorder, Jul 1, 2009 IP