<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Form Validation</title>
<style>
body {
font-family: Arial, sans-serif;
margin: 0;
padding: 0;
box-sizing: border-box;
background-color: #f0f2f5;
}
.container {
max-width: 600px;
margin: 50px auto;
padding: 20px;
background-color: white;
border-radius: 8px;
box-shadow: 0 2px 5px rgba(0,0,0,0.1);
}
.form-group {
margin-bottom: 15px;
}
.form-group label {
display: block;
margin-bottom: 5px;
font-weight: bold;
}
.form-group input {
width: 100%;
padding: 10px;
border: 1px solid #ddd;
border-radius: 5px;
font-size: 1em;
}
.form-group input:invalid {
border-color: red;
}
.form-group input:valid {
border-color: green;
}
button {
padding: 10px 20px;
border: none;
border-radius: 5px;
background-color: #007bff;
color: white;
font-size: 1em;
cursor: pointer;
}
button:hover {
background-color: #0056b3;
}
</style>
</head>
<body>
<div class="container">
<h1>Form Validation</h1>
<form>
<div class="form-group">
<label for="name">Name</label>
<input type="text" id="name" required>
</div>
<div class="form-group">
<label for="email">Email</label>
<input type="email" id="email" required>
</div>
<div class="form-group">
<label for="age">Age</label>
<input type="number" id="age" min="1" max="120" required>
</div>
<button type="submit">Submit</button>
</form>
</div>
</body>
</html>
表单验证
原创mb64cc5144d532c ©著作权
©著作权归作者所有:来自51CTO博客作者mb64cc5144d532c的原创作品,请联系作者获取转载授权,否则将追究法律责任
提问和评论都可以,用心的回复会被更多人看到
评论
发布评论
相关文章
-
VLAN模式 TAG UNTAG怎么选
VLAN配置学习总结创建VLAN的命令(以华为设备为例)在系统模式下进行操作[SW1] vlan 20 //单个创建vlan[SW1-vlan20] description vlan-test vlan20 //相关描述信息将改变显示的描述 20 enable default &n
VLAN模式 TAG UNTAG怎么选 Ethernet List Access