views:

59

answers:

2

I am currently having trouble getting rid of a sliver of white...

Here is an example page: http://m.stackoverflow.quickmediasolutions.com/view_question.php?id=97969&site=serverfault

As you can see, the answers have a sliver of white stuffed between the top of the 'button' and the content.

Here is some relevant code:

<!-- this is the top of the 'button' -->
<div class='top'></div>

<!-- right here is where the space is -->
<div class='content'></div>

.top {
    height: 5px;
}
.content {
    display: block;
    padding-left: 10px;
}

Edit: this problem is fixed now and I will accept the answer below shortly.

+4  A: 

This looks like native margin the <p> element has:

.question p { margin: 0 }

A relevant tip here it to use a CSS-Reset, it eliminates most of these oddities and cross-browser compatibility issues.

Kobi
I *wondered* if it had something to do with that but really was clueless as to what to do about it - I've had problems like that before :)
George Edison
+1 Agreed, its the margin of the paragraph creating the whitespace
Cez
@Cez: And it's fixed now.
George Edison
@George If you use *{margin:0;padding:0;} as the first style, then you will only get margin and padding that you specifically apply, which can help you avoid "mystery" whitespace
Cez
@Cez: Great tip... I just might do that.
George Edison
A: 

you know, you'd be surprised how often whitespace breaks layout. I found out the hard way.

Just for $hits and giggles write it out together and see what happens:

<div class='top'></div><div class='content'></div>

and of course I would make sure that in your css you define margin:0px; for both divs

Raine