<p> seperating <div>'s?

Discussion in 'CSS' started by awesty, Jun 11, 2007.

  1. #1
    I have 3 divs, one is a header, one is a footer and one is the content:

    |-------------| header
    |..................|
    |..................| content
    |..................|
    |..................|

    |-------------| footer

    If I use a <p> at the bottom of the content div or at the top, it seperates the header or footer (depending whether the <p> is at the top or bottom).

    |-------------| header

    |..................|
    |..................| content
    |..................|
    |..................|


    |-------------| footer

    Is there anyway to stop this from happening?

    Thanks. :)
     
    awesty, Jun 11, 2007 IP
  2. Dan Schulz

    Dan Schulz Peon

    Messages:
    6,032
    Likes Received:
    436
    Best Answers:
    0
    Trophy Points:
    0
    #2
    You shouldn't be using markup (HTML) like that. What does your code look like?
     
    Dan Schulz, Jun 11, 2007 IP
  3. CriminalOrigins

    CriminalOrigins Peon

    Messages:
    276
    Likes Received:
    3
    Best Answers:
    0
    Trophy Points:
    0
    #3
    A quick way to solve your problem:
    
    p {
        margin: 0px;
        font-size: 0px;
    }
    
    Code (markup):
     
    CriminalOrigins, Jun 11, 2007 IP
  4. kk5st

    kk5st Prominent Member

    Messages:
    3,497
    Likes Received:
    376
    Best Answers:
    29
    Trophy Points:
    335
    #4
    kk5st, Jun 11, 2007 IP
  5. awesty

    awesty Active Member

    Messages:
    247
    Likes Received:
    3
    Best Answers:
    0
    Trophy Points:
    58
    #5
    <div id="maintxt">
                	<p>Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Pellentesque auctor, sapien eget viverra laoreet, velit purus ultrices risus, a sollicitudin ligula massa ac massa. Sed tempus. Nullam lorem neque, commodo eget, eleifend a, condimentum at, felis. Suspendisse ligula neque, tempus vel, rhoncus vitae, tempor non, leo. Pellentesque dui dolor, congue at, suscipit sed, placerat eu, arcu. Aliquam erat volutpat. Nulla id sapien id odio tempor vulputate. Donec ultricies vestibulum velit. Proin turpis ante, cursus ac, mollis nec, lacinia id, eros. Etiam felis. Aliquam viverra felis ac nulla. Integer pede. Fusce adipiscing purus non libero. Nunc posuere pretium nisl. Aliquam suscipit dignissim tellus. Vivamus aliquet lorem ac lectus. In varius commodo nibh.</p>
    
    HTML:
    etc...

    Thankyou.
     
    awesty, Jun 11, 2007 IP
  6. Dan Schulz

    Dan Schulz Peon

    Messages:
    6,032
    Likes Received:
    436
    Best Answers:
    0
    Trophy Points:
    0
    #6
    Ok. I was under the impression that you were using <p> tags to create extra space. Sorry.
     
    Dan Schulz, Jun 11, 2007 IP
  7. CriminalOrigins

    CriminalOrigins Peon

    Messages:
    276
    Likes Received:
    3
    Best Answers:
    0
    Trophy Points:
    0
    #7
    That's what I thought as well.

    Anyway, you can just take out the font-size: 0px; attribute from my earlier code and the extra space to the top and bottom should go away.
     
    CriminalOrigins, Jun 11, 2007 IP