Hi, I would like to have paragraph text right under the headline. I set margin and padding to 0 for both, but there is still small gap between them. Why? Thanks.
A:
Make sure that you remove the bottom padding and margin for the heading above and you should be set
<style>
.h2 { margin-bottom:0px; padding-bottom:0px; }
p { margin:0px; padding:0px 0px 15px 0px; }
</style>
I've added a padding-bottom to the paragraph tags so you can have separation between each <p>
tag.
Jon Harding
2010-09-22 14:44:09
Don't put a global P margin like that, it will affect all P tags. Instead focus on a rule for that particular paragraph, or use selectors to select the next element. See where this can become tricky?
drachenstern
2010-09-22 16:02:33
+1
A:
line-height:1em;
also add a border for testing:
border:1px solid #f00;
revaxarts
2010-09-22 14:44:26
+1
A:
It is from the line-height property of the headline.
Try it like this:
<h1 style="margin:0; padding:0; line-height:1em;">Heading</h1>
<p style="margin:0;">Paragraph</p>
Parkyprg
2010-09-22 14:48:08