基于HTML5和CSS3搭建一个Web网页
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Document</title>
<style>
body {
margin: 0;
height: 100vh;
display: flex;
justify-content: center;
align-items: center;
background-color: #f7f7f7;
font-family: Arial, sans-serif;
}
.container {
width: 80%;
max-width: 600px;
text-align: center;
}
.input-container {
margin: 20px 0;
padding: 10px;
background-color: #fff;
border: 1px solid #ddd;
border-radius: 5px;
}
input[type="text"] {
width: 100%;
padding: 10px;
border: none;
border-radius: 5px;
font-size: 16px;
outline: none;
}
input[type="submit"] {
width: 100%;
padding: 10px;
background-color: #5cb85c;
color: white;
border: none;
border-radius: 5px;
cursor: pointer;
font-size: 16px;
outline: none;
}
input[type="submit"]:hover {
background-color: #449d44;
}
</style>
</head>
<body>
<div class="container">
<form>
<div class="input-container">
<input type="text" required placeholder="请输入您的名字">
</div>
<div class="input-container">
<input type="email" required placeholder="请输入您的邮箱">
</div>
<div class="input-container">
<input type="text" required placeholder="请输入您的手机号码">
</div>
<div class="input-container">
<input type="submit" value="提交">
</div>
</form>
</div>
</body>
</html>
这段代码使用了HTML5和CSS3来创建一个简单的表单页面。它包括了表单元素的使用,还有CSS样式的应用,使得页面更加美观和易于使用。代码中的样式主要是通过flexbox布局来实现表单的垂直居中和水平居中,并为表单元素设置了统一的样式。
评论已关闭