I'm trying to create a layer inside another with a margin, but I'm not able to do it.
The HTML code is:
<div className = "sizeMD">
<div className = "container">
<div className = "marco">
hola
</div>
</div>
</div>
The <div>
with className = "container"
has an image like a background image and inside of this I want to create another which would be a margin: 5%;
up, right, down and left. So, this layer would be always inside the other layer with that margin.
The CSS is:
.container{
position: relative;
padding: 0%;
background-image: url("http://ec2-54-171-196-69.eu-west-1.compute.amazonaws.com/static/media/bread.b9ced272.png");
background-size: 100% auto;
background-repeat: no-repeat;
background-position: left top;
height: 450px;
}
.marco{
position: absolute;
margin: 5%;
top: 0;
left:0;
width: 100%;
height: auto;
background-color: yellow;
}
And this is what I get right now:
I would like that yellow layer would be always inside of the layer with the image in background.
Edit
Following the wise advice of @admcfajn the yellow layer is contained inside of layer container, but the height of this layer is not enough.
What can I do to make the height of the container bigger than yellow?