Вы можете position
h2
как absolute
, а также установить right
и left
margin
s как auto
, а его значения right
и left
как 0:
.logos-container h2 {
position: absolute;
left: 0;
right: 0;
margin-left: auto;
margin-right: auto;
}
Будьте осторожны, так как при изменении размера браузера он будет перекрываться с другими дочерними элементами.
Fiddle: https://jsfiddle.net/kdw7vcfy/3/
* {
margin: 0;
padding: 0;
}
.logos-container {
display: flex;
flex-direction: row;
flex-wrap: wrap;
align-items: center;
justify-content: left;
padding: 12px 8rem;
text-transform: uppercase;
font-family: 'Roboto', sans-serif;
font-weight: 700;
font-size: 1rem;
text-align: center;
color: #001C44;
border-bottom: solid 1px #cdd1d3;
box-shadow: 0px 3px 5px -1px rgba(50, 50, 50, 0.35);
margin-top: 5px;
}
.logos-container img {
height: 3rem;
}
.logos-container h2 {
position: absolute;
left: 0;
right: 0;
margin-left: auto;
margin-right: auto;
}
.loginContainer {
background: url("https://i.ibb.co/NnfNFJ1/fatura.png") no-repeat left 20px;
background-size: 24%;
height: calc(100vh - 5.25rem);
}
.footer {
font-family: 'Roboto', sans-serif;
font-size: 14px;
font-weight: 300;
padding: 0 2rem;
background: #f5f5f5;
}
.footer a {
text-decoration: underline;
color: #9B9B9B;
}
<div class="page">
<div class="logos-container">
<img src="https://i.ibb.co/njPs6xJ/min.png" class="logomin" alt="Ministerio da Educação" />
<img src="https://i.ibb.co/mcKb85g/aetr.png" class="logoaetr" alt="Agrupamento de Escolas Tomaz Ribeiro" />
<h2>Autenticação</h2>
</div>
<div class="loginContainer">
</div>
<div class="footer">
<a href="https://google.pt/">Esqueceu a sua senha?</a> <span>Versão: 1.0</span>
</div>
</div>