Home >Web Front-end >HTML Tutorial >vertical-align implements input and img alignment

vertical-align implements input and img alignment

高洛峰
高洛峰Original
2017-02-25 14:21:391563browse

Put input and img on the same line. The img tag is always higher than the input, which is very ugly. I have tried many methods before, but none of them work. Later, the most searched thing on the website was to add an align="absmiddle" attribute to img. This method seems feasible, but it does not comply with HTML standards. Later, I accidentally discovered that it is enough to add vertical-align:middle to input and img at the same time:

input,img{vertical-align:middle;}

In this way, the code will be aligned horizontally.

For more articles related to using vertical-align to align input and img, please pay attention to the PHP Chinese website!

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn