These days when you make a form, you will always encounter the check box (checkbox) and the Radio Box (radio) and the text is not aligned with the problem, if the checkbox is not floating, but the text floats. In the front-end development process, the single (complex) box and the hint text behind them in the case of no setting, is not aligned, and in Firefox and IE in a very large difference. Even if the vertical-align:middle is set, it is still not perfectly aligned.
Workaround:
1, the text size must be even, such as 12PX.
2. Add text to label and Vertical-align:middle style.
3. Then remove the margins from the form element.
Case:
<!DOCTYPE HTML Public "-//W3C//DTD XHTML 1.0 transitional//en" "http://www.w3.org/TR/xhtml1/DTD/ Xhtml1-transitional.dtd "><HTMLxmlns= "http://www.w3.org/1999/xhtml"><Head> <Metahttp-equiv= "Content-type"content= "text/html; charset=utf-8" /> <title>Test Vertical-align</title> <style> *{margin:0;}label{vertical-align:Middle}. Inputcheckbox{vertical-align:Middle;}Body{font-family:Tahoma;font-size:12px;} </style></Head><Body> <inputclass= "Inputcheckbox"name= "Test"value= "1"type= "checkbox"> <label>Test text X</label> <BR/><BR/> <inputclass= "Inputcheckbox"name= "Test2"value= "2"type= "Radio"> <label>Test text X</label> <BR/><BR/> <inputclass= "Inputcheckbox"name= "Text1"type= "text" /> <label>Text</label> <inputclass= "Inputcheckbox"name= "Text1"type= "text" /> <label>Text</label> <BR/><BR/> <label>Test text</label> <inputclass= "Inputcheckbox"name= "Button1"type= "button"value= "button" /> <BR/><BR/> <Selectclass= "Inputcheckbox"name= "Select1"> <option>Test text</option> </Select> <label>Test text</label></Body></HTML>
Text and form (Checkbox/radio) Element vertical alignment method, compatible with Firefox and IE.