css控制表单样式

css控制表单样式

input样式

 

实例:

 程序代码:

<!doctype html>
<html>
<head>
<meta charset="utf-8">
<title>css控制表单样式</title>
	<style>
		*{margin: 0;padding: 0;border: none;}
		form{
			width: 300px;
			height: 120px;
			background: #BFFCFF;
			margin: 50px auto;
			font-size: 14px;
			padding-top: 30px;
			}
		.a{
			padding-left: 23px;
			}
		.b{padding-left: 57px;}
		.text{width: 160px;
			height: 20px;
			background:#ffffff url("sucai/1.jpg") no-repeat 3px center;
			padding-left: 20px;
			color: #B7BABA;
			border: 1px solid #56CFFF;
			}
		.password{width: 180px;	
			height: 20px;
			background:#ffffff url("sucai/2.jpg") no-repeat 3px center;
			margin-top: 10px;
			border: 1px solid #56CFFF;
				}
		.btn{width: 187px;
			height: 24px;
			background: url("sucai/5.jpg") no-repeat 90px;
			margin-top: 10px;
			}
	</style>
</head>
<body>
	<form action="" method="post" name="list">
	<div class="a">账号/号码:
	<input type="text" value="itcast" class="text">
	</div>
	<div class="b">密码:	
	<input type="password" class="password">
	</div>
	<input type="button" class="btn">
	</form>
</body>
</html>

  • 0
    点赞
  • 7
    收藏
    觉得还不错? 一键收藏
  • 打赏
    打赏
  • 0
    评论
代码实现如下: HTML部分: ``` <div class="register-box"> <form action=""> <div class="bg-img"></div> <ul> <li> <label for="username">用户名:</label> <input type="text" id="username" name="username"> </li> <li> <label for="password">密码:</label> <input type="password" id="password" name="password"> </li> <li> <label for="confirm-password">确认密码:</label> <input type="password" id="confirm-password" name="confirm-password"> </li> <li> <label for="email">邮箱:</label> <input type="email" id="email" name="email"> </li> <li class="code"> <label for="code">验证码:</label> <input type="text" id="code" name="code"> <ul> <li><img src="code.jpg" alt="验证码"></li> <li><a href="#">换一张</a></li> </ul> </li> <li class="submit"> <input type="submit" value="注册"> </li> </ul> </form> </div> ``` CSS部分: ``` .register-box { width: 400px; margin: 50px auto; position: relative; } .bg-img { width: 100%; height: 400px; background-image: url(bg.jpg); background-size: cover; position: absolute; top: 0; left: 0; opacity: 0.5; } ul { list-style: none; margin: 0; padding: 0; } li { float: left; width: 100%; margin-bottom: 10px; } label { display: inline-block; width: 80px; text-align: right; margin-right: 10px; } input[type="text"], input[type="password"], input[type="email"] { width: 200px; height: 25px; border: 1px solid #ccc; border-radius: 5px; padding: 3px; } li.code { height: 40px; } li.code ul { float: left; } li.code ul li:first-child { margin-right: 10px; } li.submit { text-align: center; clear: both; } input[type="submit"] { width: 80px; height: 30px; background-color: #4CAF50; color: #fff; border: none; border-radius: 5px; cursor: pointer; } a { color: #333; text-decoration: none; } ```

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

不止代码

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值