CSS might be a total mystery to you or a topic that’s near and dear to your heart. Whether you think of CSS as a "necessary evil" or think of it as the power to control the world of technology, CSS is a must-have for anyone working on web applications. A deep knowledge of CSS can be the difference between a beautiful, polished web application and one that just feels like "meh".
In this series, I try to focus on CSS weird parts, throw quiz and its answer, hoping to give a better understanding of how CSS works in depth.
Having the following code snippet, for two adjacent siblings divs,
#div1 has a margin of 50px,
#div2 has a margin of 20px.
what is the distance between those two div?
<div id="div1" style="margin: 50px;">A</div> <div id="div2" style="margin: 20px;">B</div>
you can find the answer below, but please give yourself a couple of minutes to think about it, to make sure you benefit from this quiz.
The correct answer is:
If you wonder why this is the correct answer, please read the discussions below.
Cover image original artwork by: Sergi Delgado