【html+css】html登录注册页面

1 篇文章 1 订阅

为大家提供一个登录注册的html代码,包含css样式代码,需要的朋友可以直接用,背景图片可根据自己的想法调换,本篇未提供背景图片。

登录页面展示

注册页面显示

 html代码

登录页面

<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>登录</title>
    
    <link rel="stylesheet" href="css/login.css">
</head>	
	<style>
		body{
			background: url("img/logo.jpg");
			background-position: center;
			background-size: 100%;
		} 
	</style>
<body>
    <div class="主体区">
        <div class="登录框">
            <form action="">
                <h2>登录</h2>
                <div>
                    <span>用户名</span>
                    <input type="text" class="text" placeholder="请输入用户名">
                </div>
                <div>
                    <span>密码</span>
                    <input type="password" class="text" placeholder="请输入密码">
                </div>
                <div>
					<a href="index.html"><input type="button" class="提交" value="登录"></a>
				</div>
				<div>
					<a href="logon.html" ><input type="button" class="提交" value="注册"></a>
				</div>
				<div>
					<a href="index.html" ><input type="button" value="返回"></a>
                </div>
            </form>
        </div>
    </div>
 
</body>
</html>

注册页面

<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>注册</title>
    
    <link rel="stylesheet" href="css/logon.css">
</head>
	<style>
		body{
			background: url("img/logo.jpg");
			background-position: center;
			background-size: 100%;
		} 
	</style>
<body>
    <div class="主体区">
        <div class="注册框">
            <form action="">
                <h2>注册</h2>
                <div>
                    <span>昵称</span>
                    <input type="text" class="text" placeholder="请输入昵称">
                </div>
                <div>
                    <span>年龄</span>
                    <input type="text" class="text" placeholder="请输入年龄">
                </div>
                <div>
                    <span class="sex">性别</span>
                    <input type="radio" name="sex">男
                    <input type="radio" name="sex">女
                </div>
                <div>
                    <span class="hobby">爱好</span>
                    <input type="checkbox">吃饭
                    <input type="checkbox">睡觉
                    <input type="checkbox">打游戏
                </div>
                <div>
                    <span>职业</span>
                    <input type="text" class="text" placeholder="请输入职业">
                </div>
                <div>
                    <span>Email</span>
                    <input type="text" class="text" placeholder="请输入Email">
                </div>
                <div>
                    <span>密码</span>
                    <input type="password" class="text" placeholder="请输入密码">
                </div>
                <div>
                    <span>再次确认密码</span>
                    <input type="password" class="text" placeholder="请再次确认密码">
                </div>
                <div>
                    <input type="button" class="提交" value="注册">
				</div>
				<div>
					<a href="login.html" ><input type="button" class="提交" value="返回登录"></a>
                </div>
            </form>
        </div>
    </div>
 
</body>
</html>

 css样式

登录页面css

.主体区 {
    padding: 150px;
    display: flex;
    align-items: center;
    flex-direction: column;
}
 
.登录框 {
    width: 350px;
    height: 300px;
    padding-top: 50px;
    padding-bottom: 50px;
 
    border-radius: 10px;
    background-color: rgba(255,255,255,0.7);
}
 
form {
    height: 100%;
 
    display: flex;
    align-items: center;
    flex-direction: column;
    justify-content: space-between;
}
 
h2 {
    font-size: 40px;
}
 
span {
	font-size: 20px;
    display: inline-block;
    width: 90px;
    text-align: left;
}
 
.提交 {
    width: 260px;
    height: 30px;
 
    background: rgba(77,132,226);
    color: white;
    border: none;
}
 
.text {
    width: 165px;
    height: 25px;
    padding-left: 10px;
 
    border-radius: 5px;
    border: none;
}

注册页面css

.主体区 {
    padding: 30px;
    display: flex;
    align-items: center;
    flex-direction: column;
}
 
.注册框 {
    width: 360px;
    height: 500px;
    padding-top: 50px;
    padding-bottom: 50px;
 
    border-radius: 10px;
    background-color: rgba(255,255,255,0.7);
}
 
form {
    height: 100%;
 
    display: flex;
    align-items: center;
    flex-direction: column;
    justify-content: space-between;
}
 
h2 {
    font-size: 20px;
}
 
span {
    display: inline-block;
    width: 120px;
    text-align: left;
}
.sex {
    width: 225px;
}
 
.hobby {
    width: 125px;
}
 
.提交 {
    width: 290px;
    height: 30px;
 
    background: rgba(77,132,226);
    color: white;
    border: none;
}
 
.text {
    width: 165px;
    height: 25px;
    padding-left: 10px;
 
    border-radius: 5px;
    border: none;
}

HTMLCSS和JSP是常用于构建网页和实现用户交互的前端技术。下面是一个简单的HTML+CSS+JSP登录注册页面的示例: HTML部分: ```html <!DOCTYPE html> <html> <head> <title>登录注册页面</title> <link rel="stylesheet" type="text/css" href="style.css"> </head> <body> <div class="container"> <h1>登录</h1> <form action="login.jsp" method="POST"> <label for="username">用户名:</label> <input type="text" id="username" name="username" required><br> <label for="password">密码:</label> <input type="password" id="password" name="password" required><br> <input type="submit" value="登录"> </form> <h1>注册</h1> <form action="register.jsp" method="POST"> <label for="newUsername">用户名:</label> <input type="text" id="newUsername" name="newUsername" required><br> <label for="newPassword">密码:</label> <input type="password" id="newPassword" name="newPassword" required><br> <input type="submit" value="注册"> </form> </div> </body> </html> ``` CSS部分(style.css): ```css .container { width: 300px; margin: 0 auto; padding: 20px; border: 1px solid #ccc; } h1 { text-align: center; } label { display: block; margin-bottom: 10px; } input[type="text"], input[type="password"] { width: 100%; padding: 5px; margin-bottom: 10px; } input[type="submit"] { width: 100%; padding: 10px; background-color: #4CAF50; color: white; border: none; cursor: pointer; } ``` JSP部分(login.jsp和register.jsp): ```jsp <%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%> <!DOCTYPE html> <html> <head> <title>登录注册页面</title> </head> <body> <%--%> <% if (request.getParameter("username") != null && request.getParameter("password") != null) { %> <% String username = request.getParameter("username"); %> <% String password = request.getParameter("password"); %> <%-- 在这里进行登录验证的逻辑处理 --%> <%-- 如果验证通过,可以进行页面跳转或其他操作 --%> <h2>登录成功!</h2> <% } %> <%-- 注册处理 --%> <% if (request.getParameter("newUsername") != null && request.getParameter("newPassword") != null) { %> <% String newUsername = request.getParameter("newUsername"); %> <% String newPassword = request.getParameter("newPassword"); %> <%-- 在这里进行注册逻辑处理 --%> <%-- 如果注册成功,可以进行页面跳转或其他操作 --%> <h2>注册成功!</h2> <% } %> </body> </html> ``` 以上是一个简单的HTML+CSS+JSP登录注册页面的示例,你可以根据自己的需求进行修改和扩展。
评论 11
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

打赏作者

陈 迷学习

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

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

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

打赏作者

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

抵扣说明:

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

余额充值