Jump to content

A tricky question about margin


Recommended Posts



Consider a web page with two adjacent paragraphs:

<p>  first paragraph</p><p>  second paragraph</p>

With this CSS code applied to a web page:

p {  background-color: red;  margin-top: 50px;  margin-bottom: 50px;}

What will be the distance between the two red rectangles displayed for the background color of these paragraphs?


Answer: I thought it should be 100px but NO, the distance between two paragraphs would be only 50px.


Can some one please explain WHY??











Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

  • Create New...