CSS fix input tag differences in various browsers

Source: Internet
Author: User
First, explain how the form label (input, select) might behave differently in various browsers:
1. When input or select is mixed with other labels (for example, a, label), there may be a problem that is not centered.
2 .... When mixed, the outer label does not control the form label.
3.input inside the text line high There are differences, there are gaps and so on.


Parsing phenomena:
Input:text characteristics,
By default:
Height of 1.firefox height is 14px under 16px;ie;
2. Font size: 13.3333px;
3.input exists padding value: Firefox: padding:1px 0;ie: padding:1px 0 3px 0;
Solution Example: The following code:


<! DOCTYPE HTML PUBLIC "-//W3C//DTD XHTML 1.0 transitional//en" ">
<meta http-equiv= "Content-type" content= "text/html; Charset=utf-8 "/>
<title> Untitled Document </title>
<style type= "Text/css" >
Body {
font-family: "Song Body";
font-size:12px;
}

Table {
Border-collapse:collapse;
Border:solid Red 1px;
}
td,th {
Border:solid Red 1px;
height:40px;
}
Label {
Vertical-align:middle;
}
. inputtxt {
width:200px;
padding:0;
font-family: "Song Body";
font-size:12px;
height:15px;
line-height:15px;
Vertical-align:middle;
Border:solid #0000FF 1px;
}

</style>
<body>
<form action= "#" method= "POST" >
<table>
<tr>
<th width= ">firt</th>"
<TD ><input name= "AJ" type= "text" maxlength= "6" class= "Inputtxt"/>
<label> know </label>
<input type= "Text" maxlength= "6" class= "Inputtxt"/></td>
</tr>
<tr>
<th>second</th>
<td>
<input name= "BS" type= "text" maxlength= "6" class= "Inputtxt"/></td>
</tr>
</table>
</form>
</body>

In this case, IE and Firefox are the same as:

  • 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.