通过css控制HTML文本框中的文字垂直居中
来源:互联网 发布:linux dns mx 编辑:程序博客网 时间:2024/04/25 18:24
当定义了 Text 的 height 属性时,在 Text 中输入的文字都不是垂直居中的,不过你可以添加CSS来控制它,让输入的文字垂直居中,使网页更完美。
<html>
<head>
<style type="text/css">
#text {
height:20px;
vertical-align:middle;
line-height:20px; /*line-height must be equal to height*/
}
</style>
</head>
<body>
<table>
<input type="text" id="text">
</table>
</body>
</html>
复制代码
代码如下:<html>
<head>
<style type="text/css">
#text {
height:20px;
vertical-align:middle;
line-height:20px; /*line-height must be equal to height*/
}
</style>
</head>
<body>
<table>
<input type="text" id="text">
</table>
</body>
</html>
加入 verticla-align、line-height 两个属性后,文本框中的文字就在文本框中垂直居中了,要注意的是 line-height 必须要等于 height 。
原文链接:http://www.jb51.net/web/137839.html
0 0
- 通过css控制HTML文本框中的文字垂直居中
- HTML中的文本框中的文字垂直居中
- CSS控制table中的文字垂直居中
- CSS 解决表单单行文本框中的文字垂直居中问题
- 通过CSS控制垂直居中
- 让HTML中的文本框<input type="text">中的文字垂直居中
- 让HTML中的文本框<input type="text">中的文字垂直居中
- css如何让文本框中的输入的文字始终垂直居中
- css如何让文本框中的输入的文字始终垂直居中
- css如何让文本框中的输入的文字始终垂直居中
- CSS 文字 垂直 居中
- css 文字垂直居中
- CSS文字垂直居中
- input文本框文字垂直居中
- input文本框文字垂直居中
- html文字垂直居中
- 怎么让文本框中的文字垂直方向居中
- css 让文字垂直居中
- Error running app: Instant Run requires 'Tools | Android | Enable ADB integration' to be enabled
- 关于Android中XML解析方式
- Permutations
- MySQL数据库事务简介
- sql--substr--截取字段值
- 通过css控制HTML文本框中的文字垂直居中
- Ext 要讲json拼成Ext的datagrid格式的字符串
- 【BZOJ 3527】 [Zjoi2014]力|FFT
- intellij 13新建javaweb项目并用tomcat 7启动
- cookie 使用
- MySQL性能优化的最佳20+条经验
- 集成Dubbo服务(Spring)
- CentOS下phpMyAdmin安装
- MySQL实现大整数相加的udf