CSS(层叠样式表)是一种用于描述HTML或XML(包括SVG、MathML等各种XML方言)文档样式的样式表语言。通过CSS,可以控制页面的布局、颜色、字体等视觉效果。
style
属性定义样式。<head>
部分使用<style>
标签定义样式。<link>
标签引入到HTML文档中。CSS广泛应用于网页设计、移动应用界面设计、企业内部系统界面设计等场景。
以下是一个简单的登录页面模板器的CSS代码示例:
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Login Page</title>
<style>
body {
font-family: Arial, sans-serif;
background-color: #f4f4f4;
display: flex;
justify-content: center;
align-items: center;
height: 100vh;
margin: 0;
}
.login-container {
background-color: #fff;
padding: 20px;
border-radius: 8px;
box-shadow: 0 0 10px rgba(0, 0, 0, 0.1);
width: 300px;
}
.login-container h2 {
margin-bottom: 20px;
text-align: center;
}
.form-group {
margin-bottom: 15px;
}
.form-group label {
display: block;
margin-bottom: 5px;
}
.form-group input {
width: 100%;
padding: 10px;
border: 1px solid #ccc;
border-radius: 4px;
}
.form-group input:focus {
border-color: #007BFF;
outline: none;
}
.btn-login {
width: 100%;
padding: 10px;
background-color: #007BFF;
border: none;
border-radius: 4px;
color: #fff;
font-size: 16px;
cursor: pointer;
}
.btn-login:hover {
background-color: #0056b3;
}
</style>
</head>
<body>
<div class="login-container">
<h2>Login</h2>
<div class="form-group">
<label for="username">Username</label>
<input type="text" id="username" name="username">
</div>
<div class="form-group">
<label for="password">Password</label>
<input type="password" id="password" name="password">
</div>
<button class="btn-login">Login</button>
</div>
</body>
</html>
通过以上方法,可以有效地制作出一个美观且功能齐全的登录页面模板器。
领取专属 10元无门槛券
手把手带您无忧上云