.login { display: flex; justify-content: center; align-items: center; height: 100%; background-color: rgba(184, 153, 90, 0.62); } .login-box { width: 1000px; height: 474.38px; border-radius: 8px; display: flex; } .login-box img { width: 60%; height: auto; } .title { margin: 0px auto 30px auto; text-align: center; color: #707070; } .login-form { background: #fdfdfd; width: 40%; border-radius: 0px 8px 8px 0px; display: flex; justify-content: center; align-items: center; } .login-form .el-form { width: 214px; height: 307px; } .login-form .el-form-item { margin-bottom: 30px; } .login-form .el-form-item.is-error .el-input__inner { border: 0 !important; border-bottom: 1px solid #fd7065 !important; background: #fff !important; } .login-form .input-icon { height: 32px; width: 18px; margin-left: -2px; } .login-form .el-input__inner { border: 0; border-bottom: 1px solid #e9e9e8; border-radius: 0; font-size: 14px; font-weight: 400; color: #333333; height: 32px; line-height: 32px; } .login-form .el-input__prefix { left: 0; } .login-form .el-input--prefix .el-input__inner { padding-left: 26px; } .login-form .el-input__inner::placeholder { color: #aeb5c4; } .login-form .el-form-item--medium .el-form-item__content { line-height: 32px; } .login-form .el-input--medium .el-input__icon { line-height: 32px; } .login-btn { border-radius: 17px; padding: 11px 20px !important; margin-top: 10px; font-weight: 500; font-size: 14px; border: 0; background-color: #ffc200; } .login-btn:hover, .login-btn:focus { /* background: #FFC200; */ /* color: #ffffff; */ } .login-form-title { height: 36px; display: flex; justify-content: center; align-items: center; margin-bottom: 40px; } .login-form-title .title-label { font-weight: 500; font-size: 20px; color: #333333; margin-left: 10px; }
时间: 2023-12-06 13:41:06 浏览: 45
这是一段 CSS 样式代码,用于设置登录页面的样式。其中包括登录框的大小、颜色、输入框的样式、按钮的样式等。它使用了 flex 布局来使页面元素居中对齐,并使用了 border-radius 属性来设置圆角。此外,它还定义了:hover 和:focus 状态下按钮的样式,使用户能够在鼠标悬停或聚焦时获得反馈。
相关问题
<!DOCTYPE html> <html> <head> <meta charset="UTF-8"> <meta http-equiv="X-UA-Compatible" content="IE=edge"> <title>登录界面</title> <style> body { margin: 0; padding: 0; background-color: #f2f2f2; font-family: 'Lucida Sans', 'Lucida Sans Regular', 'Lucida Grande', 'Lucida Sans Unicode', Geneva, Verdana, sans-serif; } #page_login { display: flex; justify-content: center; align-items: center; height: 100vh; } .loginContainer { display: flex; flex-direction: column; align-items: center; justify-content: center; background-color: white; border-radius: 5px; box-shadow: 0px 0px 10px rgba(0,0,0,0.2); padding: 30px; } .loginContainer > div { font-size: 36px; margin-bottom: 20px; text-align: center; } input[type="text"], input[type="password"] { width: 100%; padding: 10px; margin-bottom: 10px; border: none; border-radius: 5px; box-shadow: 0px 0px 5px rgba(0,0,0,0.1); } #loginButton { background-color: #007bff; color: white; padding: 10px 20px; border: none; border-radius: 5px; box-shadow: 0px 0px 5px rgba(0,0,0,0.1); transition: all 0.2s ease-in-out; } #loginButton:hover { transform: scale(1.05); box-shadow: 0px 0px 10px rgba(0,0,0,0.2); } </style> </head> <body> <!-- 登录界面 --> <div id="page_login"> <div class="loginContainer"> <div>Login</div> <input type="text" name="account" id="account" placeholder="account"> <input type="password" name="password" id="password" placeholder="password"> <button id="loginButton" onclick="getLogin()">login</button> </div> <button id="checkinto">select</button> </div> </body> <script> document.getElementById('checkinto').addEventListener('click', function() { window.location.href = 'select.html'; }); </script> <script type="text/javascript" src="./js/index.js"></script> <script src="./js/jquery-3.3.1.js"></script> </html>美化这段代码
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<title>登录界面</title>
<style>
body {
margin: 0;
padding: 0;
background-color: #f2f2f2;
font-family: 'Lucida Sans', 'Lucida Sans Regular', 'Lucida Grande', 'Lucida Sans Unicode', Geneva, Verdana, sans-serif;
}
#page_login {
display: flex;
justify-content: center;
align-items: center;
height: 100vh;
}
.loginContainer {
display: flex;
flex-direction: column;
align-items: center;
justify-content: center;
background-color: white;
border-radius: 5px;
box-shadow: 0px 0px 10px rgba(0,0,0,0.2);
padding: 30px;
}
.loginContainer > div {
font-size: 36px;
margin-bottom: 20px;
text-align: center;
}
input[type="text"], input[type="password"] {
width: 100%;
padding: 10px;
margin-bottom: 10px;
border: none;
border-radius: 5px;
box-shadow: 0px 0px 5px rgba(0,0,0,0.1);
}
#loginButton {
background-color: #007bff;
color: white;
padding: 10px 20px;
border: none;
border-radius: 5px;
box-shadow: 0px 0px 5px rgba(0,0,0,0.1);
transition: all 0.2s ease-in-out;
}
#loginButton:hover {
transform: scale(1.05);
box-shadow: 0px 0px 10px rgba(0,0,0,0.2);
}
</style>
</head>
<body>
<!-- 登录界面 -->
<div id="page_login">
<div class="loginContainer">
<div>Login</div>
<input type="text" name="account" id="account" placeholder="账号">
<input type="password" name="password" id="password" placeholder="密码">
<button id="loginButton" onclick="getLogin()">登录</button>
</div>
<button id="checkinto">选择</button>
</div>
</body>
<script>
document.getElementById('checkinto').addEventListener('click', function() {
window.location.href = 'select.html';
});
</script>
<script type="text/javascript" src="./js/index.js"></script>
<script src="./js/jquery-3.3.1.js"></script>
</html>
html css js 宠物网站 代码 功能:登录注册,关于我们,宠物介绍,宠物商品
以下是一个简单的宠物网站的HTML、CSS和JavaScript代码,包括登录注册、关于我们、宠物介绍、宠物商品等功能。
HTML代码:
```html
<!DOCTYPE html>
<html>
<head>
<title>宠物网站</title>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<link rel="stylesheet" href="style.css">
</head>
<body>
<header>
<h1>宠物网站</h1>
<nav>
<ul>
<li><a href="#">首页</a></li>
<li><a href="#">宠物介绍</a></li>
<li><a href="#">宠物商品</a></li>
<li><a href="#">关于我们</a></li>
</ul>
<div id="user">
<a href="#" id="login">登录</a>
<a href="#" id="register">注册</a>
</div>
</nav>
</header>
<main>
<section id="intro">
<h2>欢迎来到宠物世界</h2>
<p>我们致力于为您提供最好的宠物服务和产品,让您的爱宠生活更加美好。</p>
</section>
<section id="pet">
<h2>宠物介绍</h2>
<div class="pet-item">
<img src="dog.jpg" alt="狗狗">
<h3>狗狗</h3>
<p>狗狗是人类最忠诚的伙伴,它们陪伴我们走过人生的每一个阶段。</p>
</div>
<div class="pet-item">
<img src="cat.jpg" alt="猫咪">
<h3>猫咪</h3>
<p>猫咪是人类的好朋友,它们温顺可爱,是家庭中的重要成员。</p>
</div>
<div class="pet-item">
<img src="bird.jpg" alt="小鸟">
<h3>小鸟</h3>
<p>小鸟是生活中的美丽元素,它们能够带给我们无尽的快乐。</p>
</div>
</section>
<section id="product">
<h2>宠物商品</h2>
<div class="product-item">
<img src="dog-food.jpg" alt="狗粮">
<h3>狗粮</h3>
<p>我们提供各种口味、各种品牌的狗粮,保证您的爱宠健康成长。</p>
</div>
<div class="product-item">
<img src="cat-toy.jpg" alt="猫玩具">
<h3>猫玩具</h3>
<p>我们提供各种有趣的猫玩具,让您的猫咪不再无聊。</p>
</div>
<div class="product-item">
<img src="bird-cage.jpg" alt="鸟笼">
<h3>鸟笼</h3>
<p>我们提供各种款式、各种材质的鸟笼,让您的小鸟住得舒适。</p>
</div>
</section>
<section id="about">
<h2>关于我们</h2>
<p>我们是一家专业的宠物服务和产品提供商,我们的使命是为您的爱宠带来更好的生活。</p>
</section>
</main>
<footer>
<p>版权所有 © 2021 宠物网站</p>
</footer>
<div id="login-modal" class="modal">
<div class="modal-content">
<span class="close">×</span>
<h2>用户登录</h2>
<form>
<label for="username">用户名:</label>
<input type="text" id="username" name="username" required>
<label for="password">密码:</label>
<input type="password" id="password" name="password" required>
<input type="submit" value="登录">
</form>
</div>
</div>
<div id="register-modal" class="modal">
<div class="modal-content">
<span class="close">×</span>
<h2>用户注册</h2>
<form>
<label for="email">邮箱:</label>
<input type="email" id="email" name="email" required>
<label for="username">用户名:</label>
<input type="text" id="username" name="username" required>
<label for="password">密码:</label>
<input type="password" id="password" name="password" required>
<input type="submit" value="注册">
</form>
</div>
</div>
<script src="script.js"></script>
</body>
</html>
```
CSS代码:
```css
* {
margin: 0;
padding: 0;
box-sizing: border-box;
}
body {
font-family: Arial, Helvetica, sans-serif;
}
header {
background: #333;
color: #fff;
padding: 20px;
}
h1 {
font-size: 32px;
}
nav {
display: flex;
justify-content: space-between;
align-items: center;
}
nav ul {
display: flex;
list-style: none;
}
nav ul li a {
color: #fff;
text-decoration: none;
padding: 10px;
}
nav ul li a:hover {
background: #fff;
color: #333;
}
#user {
display: flex;
align-items: center;
}
#user a {
color: #fff;
margin-left: 20px;
}
#user a:hover {
text-decoration: underline;
}
main {
padding: 20px;
display: flex;
flex-direction: column;
align-items: center;
}
h2 {
font-size: 24px;
margin-bottom: 20px;
}
section {
margin-bottom: 50px;
}
.pet-item {
display: flex;
flex-direction: column;
align-items: center;
margin-bottom: 20px;
}
.pet-item img {
width: 200px;
height: 200px;
object-fit: cover;
border-radius: 50%;
margin-bottom: 10px;
}
.product-item {
display: flex;
flex-direction: column;
align-items: center;
margin-bottom: 20px;
}
.product-item img {
width: 200px;
height: 200px;
object-fit: cover;
border-radius: 10px;
margin-bottom: 10px;
}
#login-modal, #register-modal {
display: none;
position: fixed;
z-index: 1;
left: 0;
top: 0;
width: 100%;
height: 100%;
overflow: auto;
background-color: rgba(0,0,0,0.5);
}
.modal-content {
background-color: #fff;
margin: 10% auto;
padding: 20px;
border: 1px solid #888;
width: 50%;
}
.close {
color: #aaa;
float: right;
font-size: 28px;
font-weight: bold;
}
.close:hover, .close:focus {
color: black;
text-decoration: none;
cursor: pointer;
}
@media (max-width: 768px) {
header {
flex-direction: column;
align-items: center;
}
nav ul {
flex-direction: column;
margin-top: 20px;
}
nav ul li {
margin-bottom: 10px;
}
#user {
margin-top: 20px;
}
#login-modal .modal-content, #register-modal .modal-content {
width: 80%;
}
}
```
JavaScript代码:
```javascript
// 获取登录和注册按钮
var loginBtn = document.getElementById('login');
var registerBtn = document.getElementById('register');
// 获取登录和注册弹出框
var loginModal = document.getElementById('login-modal');
var registerModal = document.getElementById('register-modal');
// 获取关闭按钮
var loginClose = loginModal.getElementsByClassName('close')[0];
var registerClose = registerModal.getElementsByClassName('close')[0];
// 点击登录按钮弹出登录框
loginBtn.onclick = function() {
loginModal.style.display = 'block';
}
// 点击注册按钮弹出注册框
registerBtn.onclick = function() {
registerModal.style.display = 'block';
}
// 点击关闭按钮关闭弹出框
loginClose.onclick = function() {
loginModal.style.display = 'none';
}
registerClose.onclick = function() {
registerModal.style.display = 'none';
}
// 点击其他区域关闭弹出框
window.onclick = function(event) {
if (event.target == loginModal) {
loginModal.style.display = 'none';
}
if (event.target == registerModal) {
registerModal.style.display = 'none';
}
}
```
以上代码只是一个简单的示例,实际的宠物网站需要根据需求和具体情况进行修改和完善。