让input文本框里的文字垂直居中
作者:刚子 日期:2010-03-21
水平居中非常简单:
程序代码
垂直居中方法1(据说某些浏览器不识别,测试IE和火狐正常)
程序代码
垂直居中方法2(所有浏览器通用)
程序代码
程序代码<input type="text" value="文字" style="text-align:center">
垂直居中方法1(据说某些浏览器不识别,测试IE和火狐正常)
程序代码<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<title></title>
<style type="text/css">
.ipt{width:200px;height:28px;line-height:28px}
</style>
</head>
<body>
<input type="text" class="ipt" value="文字">
</body>
</html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<title></title>
<style type="text/css">
.ipt{width:200px;height:28px;line-height:28px}
</style>
</head>
<body>
<input type="text" class="ipt" value="文字">
</body>
</html>
垂直居中方法2(所有浏览器通用)
程序代码<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<title></title>
<style type="text/css">
.ipt{width:200px;padding:8px 0}
</style>
</head>
<body>
<input type="text" class="ipt" value="文字">
</body>
</html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<title></title>
<style type="text/css">
.ipt{width:200px;padding:8px 0}
</style>
</head>
<body>
<input type="text" class="ipt" value="文字">
</body>
</html>
评论: 0 | 引用: 0 | 查看次数: -
发表评论
上一篇
下一篇

文章来自:
Tags: