How to center vertically elements of a menu

Asked

Viewed 11 times

-2

Normally I put position: Absolute/relative (depending), tranformY (50%) and top: -50%, however, as I add more elements this trick starts to fail. I would like a result like the image. What other tricks do you use?

inserir a descrição da imagem aqui

1 answer

0


flex display in container with align-items: center

.container {
  display: flex;
  align-items: center;
}

or, if you need more cross-browser, inline-block display in Childrens with vertical-align: Middle

 .children {
   display: inline-block;
   vertical-align: middle;
 }

Browser other questions tagged

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