你好,我是云桃桃。
一个希望帮助更多朋友快速入门 WEB 前端的程序媛。大专生,一枚程序媛,感谢关注。回复 “前端基础题”,可免费获得前端基础 100 题汇总,回复 “前端工具”,可获取 Web 开发工具合集
266篇原创内容-gz号
后台回复“前端工具”可获取开发工具,持续更新中
后台回复“前端基础题”可得到前端基础100题汇总,持续更新中
近期看有行内朋友(公众号:雪天前端)分享了uniapp写的高颜值登录界面火了,看来高颜值UI,确实比较受欢迎啊。
那我就写一个纯净的HTML,CSS版本的吧,代码随便拿走用~效果如图。
代码如下。
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>by:云桃桃 login 01</title>
<link rel="stylesheet" href="css/global.css" />
<link rel="stylesheet" href="css/login1.css" />
<style></style>
</head>
<body>
<div class="login-container">
<div class="login-main-box">
<div class="login-title">登录</div>
<!-- 登录表单 -->
<form action="">
<div class="login-form">
<section class="rel">
<i class="iconfont icon-user"></i>
<input class="fill-box" name="user" type="text" placeholder="请输入账号" />
</section>
<section class="rel">
<i class="iconfont icon-pwd"></i>
<input class="fill-box" name="user" type="text" placeholder="请输入密码" />
</section>
<section class="guide-box">
<a href="#">忘记密码?</a>
<a href="#">没有账号,去注册</a>
</section>
<div class="login-btn">登录</div>
</div>
</form>
<!-- 其他登录方式 -->
<div class="">
<p class="other-login-txt">——其他方式登录——</p>
<section class="other-login-box">
<a class="iconfont icon-QQ" href="#"></a>
<a class="iconfont icon-weixin1" href="#"></a>
</section>
</div>
</div>
</div>
</body>
</html>
global.css
html {
/* 750px 的设计图,1rem = 100px */
font-size: calc(100 * 100vw / 750);
}
* {
margin: 0;
padding: 0;
color: #272636;
font-size: 12px;
-webkit-tap-highlight-color: transparent;
-webkit-appearance: none;
}
body {
background-color: #fff;
}
a,
img {
-webkit-touch-callout: none;
}
body {
-webkit-overflow-scrolling: touch;
}
body::-webkit-scrollbar {
width: 0px;
}
textarea::-webkit-scrollbar {
width: 0px;
}
div::-webkit-scrollbar {
width: 0px;
}
img {
display: block;
border: none 0;
width: 100%;
}
input {
border-radius: 0;
}
input,
textarea {
border: 0 none;
display: block;
}
input[type=search] {
-webkit-appearance: none;
}
.d-block {
display: block;
}
.d-none {
display: none;
}
.v-none {
visibility: hidden;
}
/*文字和li重置*/
h1,
h2,
h3,
h4,
h5,
h6 {
font-weight: normal;
}
a {
text-decoration: none;
}
li {
list-style: none;
}
.rel {
position: relative;
}
.abs {
position: absolute;
}
.txt-over1 {
display: block;
overflow: hidden;
text-overflow: ellipsis;
white-space: nowrap;
}
.txt-over2 {
display: -webkit-box;
overflow: hidden;
text-overflow: ellipsis;
word-wrap: break-word;
white-space: normal!important;
-webkit-line-clamp: 2;
-webkit-box-orient: vertical;
}
@font-face {
font-family: 'iconfont';
src: url('../font/iconfont.ttf') format('truetype');
}
.iconfont {
font-family: "iconfont" !important;
font-size: 16px;
font-style: normal;
-webkit-font-smoothing: antialiased;
-moz-osx-font-smoothing: grayscale;
}
.icon-weixin:before {
content: "\e600";
}
.icon-pwd:before {
content: "\e626";
}
.icon-user:before {
content: "\e639";
}
.icon-weixin1:before {
content: "\e6b3";
}
.icon-QQ:before {
content: "\e73e";
}
.icon-yanzhengma:before {
content: "\e604";
}
.icon-QQ1:before {
content: "\e882";
}
login1.css
:root{
--main-color:#f2729a;
}
.login-container{
width: 100vw;
height: 100vh;
background: linear-gradient(to bottom, #f8c7c4 1%,#f2729a 50%,#f8c7c4 100%);
display: flex;
align-items: center;
justify-content: center;
}
.login-main-box{
width: 6.6rem;
box-sizing: border-box;
border-radius: 10px;
background-color: #fff;
padding:0.4rem 0.6rem;
}
.login-title{
font-size: 0.42rem;
color: var(--main-color);
letter-spacing: 3px;
font-weight: bold;
line-height: 0.6rem;
margin-bottom: 0.2rem;
}
.login-form {
margin-bottom: 0.3rem;
}
.login-form section{
margin-bottom: 0.2rem;
}
.login-form .fill-box{
background-color: #f5f5f5;
width: 5.4rem;
height: 0.8rem;
box-sizing: border-box;
padding: 0rem 0.2rem 0rem 0.6rem;
font-size: 0.3rem;
}
.login-form .fill-box:focus{
outline: none;
}
.login-form .fill-box::placeholder{
font-size: 0.3rem;
line-height: 0.8rem;
}
.login-form section .iconfont{
position: absolute;
font-size: 0.34rem;
top:0.23rem;
left: 0.1rem;
color:var(--main-color);
}
.guide-box{
display: flex;
justify-content: space-between;
}
.guide-box a{
font-size: 0.25rem;
color: #666;
}
.login-btn{
font-size: 0.4rem;
text-align: center;
color: #fff;
letter-spacing: 0.08rem;
height: 0.86rem;
line-height: 0.86rem;
border-radius: 0.43rem;
background: linear-gradient(to right, #f8c7c4 1%,#f2729a 100%);
}
.other-login-txt{
text-align: center;
font-size: 0.2rem;color: #666; line-height: 0.3rem;
}
.other-login-box{
width: 1.2rem;
margin: 0.2rem auto 0rem auto;
display: flex;
align-items: center;
justify-content: space-between;
}
.other-login-box .iconfont{
font-size: 0.4rem;
}
.other-login-box .icon-weixin1{
color: #3EB600;
}
.other-login-box .icon-QQ{
color: #559DFC;
}
喜欢就点个赞吧,后续还会不定期更新其他模板的代码。
ok,本文完。更多前端系列内容可以go公众号:云桃桃