我正在尝试创建一个简单的注册表单。为了整齐排列我使用的表格方法。但是,文本并未在表格中心对齐,而是略低于表格。我以前使用过类似的方法,但它工作正常。HTML表单输入/标签对齐
该表的代码是
Register New Account
First Name: | |
Last Name: | |
Company: | |
Address Line 1: | |
Address Line 2: | |
City: | |
Postcode: | |
Country: | |
Email: | |
Confirm Email: | |
Password: | |
Confirm Password: |
的CSS文件包含以下(注:某些在CSS文件中的元素的arn't这个页面上使用)。
body
{
background-image:url("img/backgr.jpg");
color:#9E9E9E;
font-family:Optima, ‘Lucida Grande’, ‘Lucida Sans Unicode’, Verdana, Helvetica, Arial, sans-serif;
}
#header
{
margin: 20px;
padding: 10px;
height: 60px;
}
#footer
{
margin: 20px;
padding: 10px;
height: 60px;
}
#leftcol
{
position: absolute;
left: 150px;
top: 160px;
width:400px;
}
#rightcol
{
position: absolute;
right: 150px;
top: 220px;
width: 300px;
}
.inputbox
{
background-color:black;
color:#9E9E9E;
font-family:Optima, ‘Lucida Grande’, ‘Lucida Sans Unicode’, Verdana, Helvetica, Arial, sans-serif;
box-shadow:1px;
border-radius:3px;
-webkit-border-radius:3px;
-moz-border-radius:3px;
}
.box {width:700px;padding:15px;background-color:#fff;margin-bottom:18px;border-radius:0.6em;-moz-border-radius:0.6em;-webkit-border-radius:0.6em;}
.box {
-moz-box-shadow: 4px 4px 5px #111;
-webkit-box-shadow: 4px 4px 5px #111;
box-shadow: 4px 4px 5px #111;
/* For IE 8 */
-ms-filter: "progid:DXImageTransform.Microsoft.Shadow(Strength=4, Direction=135, Color='#111111')";
/* For IE 5.5 - 7 */
filter: progid:DXImageTransform.Microsoft.Shadow(Strength=4, Direction=135, Color='#111111');
}
.head
{
margin-top:50px;
}
.input
{
font-size:14px;
}
UPDATE
虽然mason81没有解决这个特定的问题,任何人碰到这个未来应该阅读真相的只使用CSS,而不是表来对齐有关的答案。更好,更简单的方法来做到这一点。
2011-12-07
jskrwyk
+0
开始使用CSS复位,然后将这些问题要么走开,或更容易解决。查看HTML5Boilerplate以获得一个开始的好地方:http://html5boilerplate.com/ –
+2
没有用于布局的表格! –
+1
请看这里http://jsfiddle.net/ASvvQ/没有需要的表格。 –