Text is not up next to images

Asked

Viewed 25 times

0

Good afternoon, I’m building a website, and I needed the text to be next to the AETTR logo, but up and not down, someone knows how to fix it?

Example:

inserir a descrição da imagem aqui

*{
margin: 0;
padding: 0;
}
.logos-container{
    background: #ccc;
}
.logomin{
    width: 245px;
}
.logoaetr{
    width: 145px;
}
ul{
    list-style: none;
}
ul li{
    display: inline-block;
}
<div class="logos-container">
            <ul>
                <li><img src="https://i.ibb.co/njPs6xJ/min.png" class="logomin" alt="Ministerio da Educação" /></li>
                <li><img src="https://i.ibb.co/mcKb85g/aetr.png" class="logoaetr" alt="Agrupamento de Escolas Tomaz Ribeiro" /></li>
                <li><h2>Autenticação</h2></li>
            </ul>
        </div>

  • https://i.ibb.co/Hvzp8mm/Sem-T-tulo.png where the black box is, I want this so that I can then simply apply a margin top to the text and align it in the middle more or less relative to the images

  • Yes I know, I want to put the text "Authentication" up there so that I can simply apply a margin top to the text and align more or less in the middle in relation to the images.

1 answer

1


Place the property vertical-align: top in the third <li> of the list:

*{
margin: 0;
padding: 0;
}
.logos-container{
    background: #ccc;
}
.logomin{
    width: 245px;
}
.logoaetr{
    width: 145px;
}
ul{
    list-style: none;
}
ul li{
    display: inline-block;
}

.logos-container ul li:nth-child(3){
   vertical-align: top;
}
<div class="logos-container">
   <ul>
       <li><img src="https://i.ibb.co/njPs6xJ/min.png" class="logomin" alt="Ministerio da Educação" /></li>
       <li><img src="https://i.ibb.co/mcKb85g/aetr.png" class="logoaetr" alt="Agrupamento de Escolas Tomaz Ribeiro" /></li>
       <li><h2>Autenticação</h2></li>
   </ul>
</div>

The selector .logos-container ul li:nth-child(3) takes the third <li> list within div with class .logos-container.

  • Thanks, I had thought to put margin-top: -5px; but I know this is gambiarra and that probably n would work.

  • Yeah, that’d be a real gambit.

Browser other questions tagged

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