How to vertically align an HTML radio button to its label with CSS?

Spread the love

Sometimes, we want to vertically align an HTML radio button to its label with CSS.

In this article, we’ll look at how to vertically align an HTML radio button to its label with CSS.

How to vertically align an HTML radio button to its label with CSS?

To vertically align an HTML radio button to its label with CSS, we set the vertical-align property.

For instance, we write

input[type="radio"] {
  margin-top: -1px;
  vertical-align: middle;
}

to add vertical-align: middle; to vertically center the radio button to its label.

Conclusion

To vertically align an HTML radio button to its label with CSS, we set the vertical-align property.

Leave a Reply

Your email address will not be published. Required fields are marked *