清爽登录界面html,基于css3实现扁平简洁清爽的登录注册页面代码

今天给大家分享一款基于css3实现扁平简洁清爽的登录注册页面代码,使用浅色设计,兼容移动设备,加入了基本的表单验证,适合大部分网站。

error!

代码很简单有css样式,index.html两部分代码。感兴趣的朋友可以查看效果演示,也可以下载源码,此段代码适用于任何浏览器:搜狗、360、FireFox(建议)、Chrome、Safari、Opera、傲游、世界之窗,是一款不错的的特效源码!

首先是登录界面,我命名为login.html(这在代码的跳转中有作用),有几个我认为比较重要的地方我直接用//来注释了,但是小伙伴复制粘贴的时候需要把注释去掉,因为HTML注释语法不是这样的:

form

{

width:100%;

height:700px;

margin-top: 0px;

background:#008B8B;

}

div

{

display:inline-block;

padding-top: 80px;

padding-right: 20px;

}

h2

{

font-family: "微软雅黑";

font-size: 40px;

color:black;

}

#log

{

color:blue;

}

Hedy西点店欢迎您!

用户名:

密 码:     //注意:&emsp是全角空格符,占一个中文字的长度,加上可以保证用户名                                                                                         和密码对齐,小伙伴可以试着 先不加这个运行一下看一下结果

还没有账号?立即注册

然后是注册页面,我把它命名为register.html

form

{

width:100%;

height:700px;

margin-top: 0px;

background:#008B8B;

}

div

{

display:inline-block;

padding-top: 40px;

padding-left: 0px;

}

h2

{

font-family: "微软雅黑";

font-size: 40px;

color:black;

}

#reg

{

color:blue;

}

注册

用户名:

密 码:

手机号:

已有账号?请登录

3、总结:这两个页面很相似,涉及到的元素都差不多,不同的只是对页面的布局,很多地方的布局都可以进行修改得到你最满意的页面效果,也有很多元素的属性可以进一步设置,比如限制用户名和 密码的长度,加入背景图片等等,都非常简单,只要修改上面相应的一行代码即可 ,今天的分享就是这样啦~~

相关文章

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
好的,以下是一个简单的登录界面HTMLCSS3 和 JS 代码实现HTML 代码: ``` <!DOCTYPE html> <html> <head> <title>登录界面</title> <link rel="stylesheet" type="text/css" href="style.css"> </head> <body> <div class="container"> <h1>登录</h1> <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> <button type="submit" id="login-btn">登录</button> </form> </div> <script src="script.js"></script> </body> </html> ``` CSS3 代码: ``` * { margin: 0; padding: 0; box-sizing: border-box; } body { background-color: #f2f2f2; font-family: Arial, sans-serif; } .container { width: 400px; margin: 50px auto; background-color: #fff; padding: 20px; border-radius: 5px; box-shadow: 0 0 10px rgba(0, 0, 0, 0.3); } h1 { text-align: center; margin-bottom: 20px; } form { display: flex; flex-direction: column; } label { margin-bottom: 10px; } input { padding: 10px; margin-bottom: 20px; border: none; border-radius: 5px; box-shadow: 0 0 5px rgba(0, 0, 0, 0.1); } button { padding: 10px; background-color: #007bff; color: #fff; border: none; border-radius: 5px; box-shadow: 0 0 5px rgba(0, 0, 0, 0.1); cursor: pointer; transition: background-color 0.3s ease; } button:hover { background-color: #0069d9; } ``` JS 代码: ``` const form = document.querySelector('form'); const usernameInput = document.querySelector('#username'); const passwordInput = document.querySelector('#password'); const loginBtn = document.querySelector('#login-btn'); form.addEventListener('submit', (e) => { e.preventDefault(); const username = usernameInput.value.trim(); const password = passwordInput.value.trim(); if (username === '' || password === '') { alert('用户名和密码不能为空!'); } else { // 这里可以添加登录逻辑 alert(`欢迎,${username}!`); } }); ``` 希望这个简单的登录界面代码能够帮到你!

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值