Centering text in a responsive way

Asked

Viewed 140 times

1

Good afternoon! I am building a project that currently has the following problem: The text Authentication is not getting totally centralized. I thought to use margin-right (this solution works only in the resolution of my machine). I wonder if anyone can help me, follow code:

CSS:

*{
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 {
    flex: 1;
}
.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>

Non-centralized text:

inserir a descrição da imagem aqui

1 answer

-4

Looks like you need the flex Direction column, no need to justify to the left

https://jsbin.com/diwaxos/edit?output

*{
margin: 0;
padding: 0;
}

.logos-container {
display: flex;
flex-direction: column;
justify-content: center;
align-items: center;
text-transform: uppercase;
font-family: 'Roboto', sans-serif;
font-weight: 700;
font-size: 1rem;
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;
}
.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;
}

  • 2

    Consider Entering and Commenting Your Solution Better.

  • 2

    First that it is not possible to know if it was he who gave negative, and if it was, he thought it correct to give you the negative because his answer is not being useful because it does not present enough information the criteria is his and has to be respected and not questioned in the scream. If you want that point back improve the explanation.

  • Another thing the AP wants the text centered and not the logo. If you look at the question the text is already centered.

  • In his code the imgs were already centered, by align-items, only the text that was not, is what he asks...

  • The site works as follows, if the AP(Author of the Question) asked wrong worth what he asked (so much so that the question was closed). If you have a different interpretation of the question, either present in the commentary guiding the author to correct the question or then show arguing in your answer that the question has been misspelled and prove why your answer serves his problem.

Browser other questions tagged

You are not signed in. Login or sign up in order to post.