表单 文字和输入框对齐的最简单的方法
2012-11-22 16:14
134 查看
关键:
1.父元素(例如div)设置为text-align:center;
2.span元素要垂直居中,要设置line-height;同时input也要设置line-height ;两者的值设置成一样的。已经经过测试,ie8、chrome下没问题。
<div class="enter_eamil_section">
<span>邮箱</span><input type="text" name="email"/>
</div>
.enter_eamil_section{
text-align:center;
margin:45px 0;
}
.enter_eamil_section span{
font-size:16px;
margin-right:10px;
line-height:30px;
}
.enter_eamil_section input{
width:278px;
height:30px;
border:1px solid #b2bfc8;
line-height:30px;
}
1.父元素(例如div)设置为text-align:center;
2.span元素要垂直居中,要设置line-height;同时input也要设置line-height ;两者的值设置成一样的。已经经过测试,ie8、chrome下没问题。
<div class="enter_eamil_section">
<span>邮箱</span><input type="text" name="email"/>
</div>
.enter_eamil_section{
text-align:center;
margin:45px 0;
}
.enter_eamil_section span{
font-size:16px;
margin-right:10px;
line-height:30px;
}
.enter_eamil_section input{
width:278px;
height:30px;
border:1px solid #b2bfc8;
line-height:30px;
}
相关文章推荐
- CSS实现让同一行文字和输入框对齐的方法
- js简单实现表单中点击按钮动态增加输入框数量的方法
- CSS实现让同一行文字和输入框对齐的方法
- 表单元素input、按钮、文字完美垂直居中对齐方法
- 一个解决表单中的文字和文本区域(textarea)上对齐的方法
- 表单元素input、按钮、文字完美垂直居中对齐方法
- 表单元素与提示文字无法对齐的解决方法(input,checkbox文字对齐)
- 表单元素input、按钮、文字完美垂直居中对齐方法
- UIAlertView文字的最简单左对齐方法
- 图片和文字对齐的方法
- 关于checkbox与文字混排无法对齐的解决方法
- 复选框与文字对齐方法
- 提交表单 之 提示文字在输入框内部,提示文字怎么处理?
- php GD库的简单封装,图片压缩、文字水印、图片水印等方法
- 表单label与input对齐的方法
- 图标和文字无法对齐处理方法
- 图片和文字对齐的方法
- Prasely表单校验插件简单使用方法之快速入门
- js获取form表单所有数据的简单方法