Edit : I just saw that it's the ul, but should not I leave the margin relative to the father?
I'm doing something as simple as a header, but for some reason, entering a margin in the ul
produces the margin outside the parent's container.
HTML Code:
<body>
<div class="wrapper">
<div class="header">
<ul class="menu">
<li>
<a href="#">Inicio</a>
</li>
</ul>
</div>
</div>
</body>
CSS Code:
* {
margin: 0;
padding: 0;
box-sizing: border-box;
list-style: none;
}
.wrapper {
max-width: 1440px;
margin: auto;
}
.wrapper .header {
height: 800px;
width: 100%;
background-image: url("../imgs/header/header.jpg");
background-position: center;
background-repeat: no-repeat;
background-size: cover;
position: relative;
}
.wrapper .header::before {
content: '';
display: block;
position: absolute;
top: 0;
left: 0;
width: 100%;
height: 100%;
background-color: #000;
opacity: .2;
z-index: 1;
}
.wrapper .header .menu {
margin: 100px 0 0 10px;
text-transform: uppercase;
}
.wrapper .header .menu li {
padding-left: 100px;
}
.wrapper .header .menu li a {
color: #fff;
font-size: "open-sans";
}
Link to the JSFiddle that reproduces the same error: link