I have a <p>
element inside a <div>
, like this:
HTML
<div>
<p>texto</p>
</div>
CSS
div {
width: 30px;
height:30px;
background-color: green;
}
p {
width: 30px;
height:30px;
background-color: red;
margin: 10px 10px 10px 10px;
}
When I apply margin-left
it works normally, the element <p>
gets away 10px
from the left, however when I apply margin-top
, margin-bottom
or margin-right
nothing is changed, <p>
element remains in the same position. I do not understand why, does anyone know how to explain this behavior?