CSS to align input input box with IMG (picture) on the same line

Source: Internet
Author: User

How to make input input box with IMG In the same line center, because often use, by default, input and IMG Put the same line, IMG tag is always higher than the input of a head, it is difficult to see, you can refer to this article may be helpful

Put input and IMG on the same line, the IMG tag is always higher than the input of a head, ugly. Later on the site to find the most is to the IMG add a align= "Absmiddle" attribute, this method seems to be feasible, but does not conform to the HTML standard. Later found that both input and IMG add Vertical-align:middle to the line:

When writing CSS, make input and IMG align in the same line:

Copy Code code as follows:
Img{vertical-align:middle;}


Input{width: Width; height: altitude; line-height: consistent with height; margin:0px;padding;0px;font-size: Font size; border: border; Vertical-align: Center;}

or write it directly.

Copy Code code as follows:


Input,img{vertical-align:middle;}

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.