Hello Fellow Codenewbies 👋,
If you've read my previous post, you've also learned that
em can cause problems since it creates cascading effect.
That's why we preferably avoid using it for
So when or where can we use
ptag inside a
- Set the
We will not set anything to the
p tag because we only want to focus on the
margin-bottom where we apply the
Click on the CSS button on Codepen to see the code.
Now change the
When you see the rendered page, do you notice that the size of
margin-bottom is the same as the size of
But we've set the
1em. So the size should be 16px since we don't declare
font-size anywhere except the
Beside inheriting size from its parents, another thing to know about
em is that it is relative to the
font-size of its element.
Say we set a
font-size for an element. And then set the value of
padding for the same element in
padding will be relative to the
font-size of the element.
When we do responsiveness, the use of
padding would be convenient.
That's because we don't need to change the size of the
padding whenever we change the
Thank you for reading!
Last, you can find me on Twitter. Let's connect! 😊