The margin-top and margin-bottom are not applied.
Unless I set padding or border to its parent element(which is yellow box) as commented in the above code.
Appreciate if anyone can explain this to me.Preformatted text
The short answer is that vertical margins can collapse, horizontal margins can not collapse. This sometimes causes confusing behaviour even for people with a lot of CSS experience, but here’s an article that explains it really well:
did it work???[quote=“smilence97, post:4, topic:452487, full:true”]
I removed the tag purposely because I didn’t know how to post my original code.
Now I have edited the code with preformatted text in this post.
[/quote]