CSS vertical-align Tutorial

CSS vertical-align

The vertical-align property in CSS is used to vertically align elements. It can be applied to inline or inline-block elements within a container.

Here is an example of how the vertical-align property works:

Result:
This is vertically centered

In this example, the text "This is vertically centered" is vertically centered within the container by using the vertical-align: middle; property.

The vertical-align property can also take other values such as top, bottom, baseline, etc. Let's see another example:

Result:
Text aligned to the top

In this example, the text "Text aligned to the top" is aligned to the top of the container using the vertical-align: top; property.