The example in this article describes how the CSS implementation aligns the same line of text and input boxes. Share to everyone for your reference. The specific analysis is as follows:
We all know that sometimes a text input box and a piece of text on the same line, but they are not always vertically centered, look beautiful, this CSS code is to solve this problem, the top line is undefined, the following line is defined, you can see that there are obvious differences.
The
code is as follows:
<!--CTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 strict//en"
"Http://www.w3.org/tr/xhtml1/dtd/xhtml1-strict.dt-->
<html>
<head>
<title>css Let the same line of text and input boxes align </title>
<meta http-equiv= "Content-type" content= "text/html"; Charset=utf-8 "/>
<style type= "Text/css" >
#a {
height:30px;
border:1px solid #ccc;
}
#b {
margin-top:20px;
height:30px;
border:1px solid #ccc;
}
#a Input {
width:200px;
height:30px;
border:1px solid red;
}
#b Input {
width:200px;
height:30px;
border:1px solid red;
Vertical-align:middle;
}
</style>
</head>
<body>
<div id= "a" ><input/>text1</div>
<div id= "B" ><input/>text2</div>
</body>
</html>
I hope this article will help you with the DIV+CSS web design.