简单好看的登录页面html+css

目前来说,html作为常用的前端语言,使用人群的基数是很大的。做好一个前端的页面,登录页面是不可少的。

一般来说,登录页面包含账号和密码,但是你也可以在这个页面增加自己想要的,比如验证码等。本篇就是利用html和css来做一个简单的登录页面。

一、先建一个html文件

html文件可以在sublimeText,vscode等编译器创建,这一步很简单:

<!DOCTYPE html>
<html lang="en">
<head>
	<meta charset="UTF-8">
	<title>登录页面</title>
</head>
<body>
	
</body>
</html>

二、制作整体的结构框架

<body>
	<div class="box">
	<h2>Login</h2>
	<div class="in-box">
	<label>账号</label>
	<input type="text" name="">
	</div>

	<div class="in-box">
	<label>密码</label>
	<input type="password" name="">
	</div>

	<div class="btn-box">
	<a href="#">忘记密码</a>
	<div>
	<button>登录</button>
	<button>注册</button>
	</div>
	</div>
	</div>
</body>
</html>


<body>元素包含了页面的主要内容,包括用户看到的所有可见元素。在这里:

<div class="box">定义了一个具有类名为“box”的div容器,用于包裹整个登录框。
<h2>Login</h2>显示了一个标题“Login”。
<div class="in-box">和<div class="btn-box">分别定义了两个具有类名为“in-box”和“btn-box”的div容器,用于包裹输入框和按钮。
<label>账号</label>和<label>密码</label>是用来显示标签的元素,“账号”和“密码”是这些标签的文本内容。
<input type="text" name="">和<input type="password" name="">是用来接收用户输入的文本框,分别用于输入账号和密码。type="text"表示文本输入框,type="password"表示密码输入框。
<a href="#">忘记密码</a>是一个超链接,点击后可以跳转到一个页面(这里由于href="#",实际上并不会跳转到新页面),显示的文本是“忘记密码”。
<button>登录</button>和<button>注册</button>是两个按钮,用户可以点击进行登录或注册操作。


三、使用css进行修饰

利用css代码,我们可以让这个页面变得美观,更有吸引力一些,大家可以根据自己的喜好进行更改。

css代码如下:

*{
	margin: 0;
	padding: 0;
}

body{
	display: flex;
	flex-direction: column;
	justify-content: center;
	align-items: center;
	height: 100vh;
	background: url(img/11.webp) no-repeat;
	background-size: cover;
}

.box{
	border-radius: 20px;
	display: flex;
	flex-direction: column;
	justify-content: center;
	align-items: center;
	width: 350px;
	height: 380px;
	border-top: 1px solid rgba(255,255,255,0.5);
	border-left: 1px solid rgba(255,255,255,0.5);
	border-bottom:  1px solid rgba(255,255,255,0.2);
	border-right:  1px solid rgba(255,255,255,0.2);
	background: rgba(255,255,255,0.3);
}
.box .in-box{
	display: flex;
	flex-direction: column;
	justify-content: center;
	align-items: start;
	margin-bottom: 10px;
}

.box > h2{
	color: rgba(255,255,255,0.9);
	margin-bottom:20px; 
}

.box .in-box > label{
	margin-bottom: 13px;
	color: rgba(255,255,255,0.9);
	font-size: 13px;
}

.box .in-box > input{
	box-sizing: border-box;
	background: rgba(255,255,255,0.3);
	color: rgba(255,255,255,0.9);
	font-size: 14px;
	height: 35px;
	width: 250px;
	border: 1px solid rgba(255,255,255,0.5);
	border-radius: 5px;
	transition: 0.2s;
	outline: none;
	padding: 0 10px;
	letter-spacing: 1px;
}

.box .in-box > input:focus{
	border: 1px solid rgba(255,255,255,0.8);
}

.box .btn-box{
	width: 250px;
	display: flex;
	flex-direction: column;
	justify-content: center;
	align-items: start;
}
.box .btn-box > a{
	color: rgba(255,255,255,0.9);
	text-decoration: none;
	transition: 0.2s;
	font-size: 14px;
	width: 250px;
	text-align: end; 
}
.box .btn-box > a:hover{
	color: rgba(255,255,255,1);
}
.box .btn-box > div{
	
	display: flex;
	flex-direction: row;
	justify-content: center;
	align-items: start;
	margin-top: 20px;
}
.box .btn-box > div > button{
	width: 120px;
	height: 35px;
	border: 1px solid rgba(197,81,58,0.8);
	background: rgba(197,81,58,0.5);
	color: rgba(255,255,255,0.9);
	border-radius: 5px;
	transition: 0.2s;
}
.box .btn-box > div > button{
	margin-left: 10px;
}
.box .btn-box > div > button:hover{
	
	border: 1px solid rgba(248,108,76,0.8);
	background: rgba(248,108,76,0.5);
	
}

四、效果图展示


以上就是本篇内容,喜欢的友友可以参考一下!

  • 16
    点赞
  • 5
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
登录界面的HTMLCSS可以通过以下代码实现: HTML代码: ``` <!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>Login</title> <link rel="stylesheet" href="style.css"/> </head> <body> <div class="box"> <h2>Login</h2> <div class="input-box"> <label>账号</label> <input type="text"> </div> <div class="input-box"> <label>密码</label> <input type="password"> </div> <div class="btn-box"> <a href="#">忘记密码</a> <div> <button>登录</button> <button>注册</button> </div> </div> </div> </body> </html> ``` CSS代码: ``` img { width: 150px; height: 150px; } #login-img { margin-left: 30px; float: left; } #register-img { float: right; margin-right: 35px; } #img-control { margin-top: 65px; } #form-border { background-color: rgba(188, 176, 212, 0.6); width: 500px; height: 300px; position: absolute; margin: auto; top: 0; bottom: 0; left: 0; right: 0; } .form-input { width: 200px; height: 25px; padding-left: 5px; border-radius: 5px; } .form-label { margin-left: 30px; } .form-button { width: 70px; height: 30px; margin-top: 10px; margin-left: 70px; font-size: 18px; font-family: "宋体"; } #div-title { text-align: center; margin-top: 150px; } h3 { font-size: 40px; font-family: "华文彩云"; } #password { margin-top: 20px; margin-bottom: 10px; } #register { margin-left: 70px; } ``` 以上是一个简单的登录界面,其中使用了HTMLCSS来实现页面布局和样式。HTML代码包含了一个登录框的结构,包括账号输入框、密码输入框和登录、注册按钮等元素。CSS代码则定义了各个元素的样式,包括字体、颜色、大小、布局等。可以根据需要进行调整和修改。<span class="em">1</span><span class="em">2</span> #### 引用[.reference_title] - *1* [html+css 登录界面](https://blog.csdn.net/nppe6/article/details/125100555)[target="_blank" data-report-click={"spm":"1018.2226.3001.9630","extra":{"utm_source":"vip_chatgpt_common_search_pc_result","utm_medium":"distribute.pc_search_result.none-task-cask-2~all~insert_cask~default-1-null.142^v93^chatsearchT3_2"}}] [.reference_item style="max-width: 50%"] - *2* [用html+css制作简单好看的登陆注册界面](https://blog.csdn.net/weixin_47971206/article/details/118916419)[target="_blank" data-report-click={"spm":"1018.2226.3001.9630","extra":{"utm_source":"vip_chatgpt_common_search_pc_result","utm_medium":"distribute.pc_search_result.none-task-cask-2~all~insert_cask~default-1-null.142^v93^chatsearchT3_2"}}] [.reference_item style="max-width: 50%"] [ .reference_list ]
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

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

余额充值