I started to learn CSS, and I got to that example in the internet: https://www.w3schools.com/css/tryit.asp?filename=trycss_margin_shorthand
But I tried to play with it, and changed some things. Now the code looks like:
div#my {
border: 8px solid black;
margin-left: 0%;
margin-right: 0%;
height: 500px;
background-color: red;
}
div {
border: 5px solid black;
margin: inherit;
background-color: lightblue;
}
<div id="my">
<div>This div element has a top margin of 100px, a right margin of 150px, a bottom margin of 100px, and a left margin of 80px.</div>
</div>
What I see is a big blue block inside a big red block. The blue block collapse with his left and right sides to the red block's border, but from the top I have margin for some reason.
I think its because I chose inherit
in the css element. But that says that I have a default margin to the page. Please, help here to understand.