0
Hello, I’d like to know the reason for my <div>
not being centered in the middle of the page, it is in the extreme right as in the example I created below:
div#pagina-principal {
position: absolute;
width: 1000px;
background: rgba(255, 255, 255, 0.5);
margin: 0px auto 0px auto;
box-shadow: 0px 0px 10px rgba(0, 0, 0, .5);
left: 50%;
}
<div id="pagina-fundo">
<div id="fundo">
<img src="_imagens/background.jpg" alt="" />
</div>
</div>
<div id="pagina-principal">
<header id="cabecalho">
<nav id="navegacao">
<ul>
<a href="principal.html"><img src="_imagens/simbolo.webp" alt=""></a>
</ul>
</nav>
<p>
Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry's standard dummy text ever since the 1500s, when an unknown printer took a galley of type and scrambled it to make a type specimen book. It has
survived not only five centuries, but also the leap into electronic typesetting, remaining essentially unchanged. It was popularised in the 1960s with the release of Letraset sheets containing Lorem Ipsum passages, and more recently with desktop
publishing software like Aldus PageMaker including versions of Lorem Ipsum.
</p>
</header>
</div>
Take a look at this page I believe that this may be your problem: The left property added to the position property added to the margin property of the element, is what is causing the positioning error. https://www.w3schools.com/cssref/pr_pos_left.asp
– SouLinux lslife