html+css唯美登录页面,代码提供(效果展示)

文章目录

效果图

在这里插入图片描述

所有代码

<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>登陆页面</title>
        <!-- author xjt -->
</head>
<body>
    <div class="login">
        <h2>登陆\注册</h2>
        <div class="login_form">
            <span>账号:</span>
            <input type="text" placeholder="请输入账号">
            <br>
            <span>密码:</span>
            <input type="password" placeholder="请输入密码">
        </div>
        <div class="btn">
            <button class="login_btn" onclick="login()">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</button>
        </div>
    </div>
</body>
<script>
    function login(){
        console.log('登录按钮点击了');
    }
</script>
<style>
    body{
        padding: 0;
        margin: 0;
        height: 100vh;
        display: flex;
        justify-content: center;
        background-image: linear-gradient(#a18cd1 0%, #fbc2eb 100%);
        background-size: cover;
        flex: 1;
        align-items: center;
    }
    .login{
        text-align: center;
        margin: 0 auto;
        width: 600px;
        height: 520px;
        background-color: rgba(87, 86, 86, 0.2);
        border-radius: 25px;
        box-shadow: 5px 2px 35px -7px #ff9a9e;
    }
    .login h2{
        margin-top: 40px;
        color: aliceblue;
        font-weight: 100;
    }
    .login_form{
        padding: 20px;
    }
    .login_form span{
        color: rgb(131, 220, 255);
        font-size: 18px;
        font-weight: 100;
    }
    .login_form input{
        background-color: transparent;
        width: 320px;
        padding: 2px;
        text-indent: 2px;
        color: white;
        font-size: 20px;
        height: 45px;
        margin: 30px 30px 30px 5px;
        outline: none;
        border: 0;
        border-bottom: 1px solid rgb(131, 220, 255);
    }
    input::placeholder{
        color: #fbc2eb;
        font-weight: 100;
        font-size: 18px;
        font-style: italic;
    }
    .login_btn{
        background-color: rgba(255, 255, 255, 0.582);
        border: 1px solid rgb(190, 225, 255);
        padding: 10px;
        width: 240px;
        height: 60px;
        border-radius: 30px;
        font-size: 30px;
        color: rgb(100, 183, 255);
        font-weight: 100;       
        margin-top: 15px;
    }
    .login_btn:hover{
        box-shadow: 2px 2px 15px 2px rgb(190, 225, 255);
        background-color: transparent;
        color: white;
        /* 选择动画 */
        animation: login_mation 0.5s;
    }

    /* 定义动画 */
    @keyframes login_mation
    {
        from {
            background-color: rgba(255, 255, 255, 0.582);
            box-shadow: 0px 0px 15px 2px rgb(190, 225, 255);
        }
        to {
            background-color: transparent;
            color: white;
            box-shadow: 2px 2px 15px 2px rgb(190, 225, 255);
        }
    }
</style>

</html>

### 回答1: 下面是一个简单的HTML登录页面代码示例: ```html <!DOCTYPE html> <html> <head> <title>登录页面</title> </head> <body> <form> <label for="username">用户名:</label> <input type="text" id="username" name="username"> <br> <label for="password">密码:</label> <input type="password" id="password" name="password"> <br><br> <input type="submit" value="登录"> </form> </body> </html> ``` 这是一个简单的HTML登录页面。 要实现完整的登录注册功能,需要使用JavaScript和CSS。 您可以使用JavaScript来验证表单数据并发送给服务器,并使用CSS来提高页面的视觉效果。 此外,您还可以使用框架,例如Bootstrap、 Foundation、 Materialize等来简化页面的布局和样式。 ### 回答2: HTML是用来搭建网页结构的标记语言,JS是用来实现网页交互和动态效果的脚本语言,而CSS则是用来控制网页样式的样式表语言。下面是一个简单的登录注册页面的代码示例: HTML部分: ``` <!DOCTYPE html> <html> <head> <title>登录注册页面</title> <link rel="stylesheet" type="text/css" href="style.css"> <script src="script.js"></script> </head> <body> <div class="container"> <h2>登录</h2> <form id="loginForm"> <input type="text" placeholder="用户名" name="username" required> <input type="password" placeholder="密码" name="password" required> <button type="submit">登录</button> </form> <h2>注册</h2> <form id="registerForm"> <input type="text" placeholder="用户名" name="username" required> <input type="password" placeholder="密码" name="password" required> <input type="password" placeholder="确认密码" name="confirmPassword" required> <button type="submit">注册</button> </form> </div> </body> </html> ``` CSS部分(style.css): ``` .container { width: 300px; margin: 0 auto; } input, button { display: block; width: 100%; margin-bottom: 10px; } button { background-color: #4CAF50; color: white; padding: 8px 12px; border: none; cursor: pointer; } button:hover { opacity: 0.8; } ``` JS部分(script.js): ``` document.getElementById("loginForm").addEventListener("submit", function(event){ event.preventDefault(); // 阻止表单提交的默认行为 var username = event.target.username.value; var password = event.target.password.value; // 进行登录操作的逻辑 }); document.getElementById("registerForm").addEventListener("submit", function(event){ event.preventDefault(); // 阻止表单提交的默认行为 var username = event.target.username.value; var password = event.target.password.value; var confirmPassword = event.target.confirmPassword.value; // 进行注册操作的逻辑 }); ``` 以上是一个简单的登录注册页面代码示例,页面基本结构由HTML定义,样式由CSS控制,交互逻辑由JS实现。根据实际需求,还可以进一步完善页面的布局和功能。 ### 回答3: HTML、JS和CSS是用于制作网页的三种技术,下面是一个使用这三种技术制作登录注册页面的示例代码HTML部分: ``` <!DOCTYPE html> <html> <head> <link rel="stylesheet" type="text/css" href="style.css"> <script src="script.js"></script> </head> <body> <div class="container"> <form id="loginForm"> <h2>登录</h2> <input type="text" placeholder="用户名" required> <input type="password" placeholder="密码" required> <button type="submit">登录</button> </form> <form id="registerForm"> <h2>注册</h2> <input type="text" placeholder="用户名" required> <input type="password" placeholder="密码" required> <input type="password" placeholder="确认密码" required> <button type="submit">注册</button> </form> </div> </body> </html> ``` CSS部分(style.css文件): ``` .container { display: flex; justify-content: center; align-items: center; height: 100vh; } form { display: flex; flex-direction: column; align-items: center; padding: 20px; border: 1px solid #ccc; border-radius: 5px; } input { width: 200px; margin-bottom: 10px; padding: 10px; border: 1px solid #ccc; border-radius: 5px; } button { width: 100px; padding: 10px; background-color: #007bff; color: #fff; border: none; border-radius: 5px; } ``` JS部分(script.js文件): ``` document.getElementById("loginForm").addEventListener("submit", function(event){ event.preventDefault(); // 获取用户名和密码输入框的值 var username = document.getElementById("loginForm").elements[0].value; var password = document.getElementById("loginForm").elements[1].value; // 进行登录验证逻辑 // ... }); document.getElementById("registerForm").addEventListener("submit", function(event){ event.preventDefault(); // 获取用户名、密码和确认密码输入框的值 var username = document.getElementById("registerForm").elements[0].value; var password = document.getElementById("registerForm").elements[1].value; var confirmPassword = document.getElementById("registerForm").elements[2].value; // 进行注册验证逻辑 // ... }); ``` 以上代码演示了一个简单的登录注册页面,其中使用了HTML创建了页面结构,CSS设置了页面样式,JS实现了表单提交时的逻辑。用户可以在输入框中输入用户名和密码,点击登录或注册按钮时,通过JS脚本进行验证和处理。
评论 43
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

打赏作者

languageStudents

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

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

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

打赏作者

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

抵扣说明:

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

余额充值