How to use CSS to vertically align inline/inline-block elements?

Spread the love

Sometimes, we want to use CSS to vertically align inline/inline-block elements.

In this article, we’ll look at how to use CSS to vertically align inline/inline-block elements.

How to use CSS to vertically align inline/inline-block elements?

To use CSS to vertically align inline/inline-block elements, we set the vertical-align property.

For instance, we write

div > * {
  vertical-align: middle;
}

to make the divs’ contents vertically centered with vertical-align: middle;.

Conclusion

To use CSS to vertically align inline/inline-block elements, we set the vertical-align property.

Leave a Reply

Your email address will not be published.