实现了点不同的登录方式显示不同的登录画面,使用了一点js,感兴趣的可以看看怎么使用的
添加了一个遮盖层的方式,后期也是很有用的,感兴趣的可以看看怎么写的
代码如下:
/*--- jd.css ---*/
/*=============0.通用=============*/
* {
margin: 0;
padding: 0;
position: relative;
}
a {
text-decoration: none;
}
/*=============1.header===========*/
#header {
width: 100%;
height: 120px;
/*background-color: red;*/
}
#header .h-top{
width: 100%;
height: 80px;
/*background-color: hotpink;*/
}
#header .h-top .icon {
position: absolute;
left: 142px;
height: 60px;
top: 50%;
line-height: 60px;
margin: -30px 0 0 0;
}
#header .h-top .a1 {
/*布局*/
position: absolute;
right: 40px;
bottom: 10px;
/*字体*/
font-size: 12px;
color: rgb(153,153,153);
/*背景图*/
background: url(../img/q-icon.png) no-repeat 0 center;
padding-left: 20px;
}
#header .h-top a:hover {
text-decoration: underline;
color: red;
}
#header .h-bottom{
width: 100%;
height: 40px;
background-color: rgb(255,248,240);
color: rgb(153,153,153);
text-align: center;
}
#header .h-bottom img {
top: 7.5px;
margin-right: 5px;
}
#header .h-bottom p {
font-size: 12px;
display: inline-block;
height: 40px;
line-height: 40px;
}
/*=============2.content==========*/
#content {
width: 100%;
height: 514px;
background: url(../img/zjm.png) no-repeat 20% center;
background-color: rgb(11,142,212);
}
#content .iuput_div {
position: absolute;
width: 360px;
height: 438px;
background-color: white;
right: 160px;
top: 10px;
}
#content .iuput_div .info-top {
height: 100px;
text-align: center;
}
#content .iuput_div .info-top .top-top{
height: 40px;
background-color: rgb(255,248,240);
text-align: center;
}
#content .iuput_div .info-top .top-top p {
font-size: 12px;
display: inline-block;
height: 20px;
line-height: 20px;
color: rgb(153,153,153);
}
#content .iuput_div .info-top .top-top img {
top: 7.5px;
}
#content .iuput_div .info-top .top-bottom{
height: 60px;
text-align: center;
line-height: 60px;
border-bottom: 1px solid rgb(240,240,240);
}
#content .iuput_div .info-top .top-bottom button {
border: 0;
width: 160px;
height: 60px;
font-size: 25px;
text-align: center;
background-color: white;
}
#content .iuput_div .info-top .top-bottom button:hover {
outline: none;
color: red;
font-weight: bolder;
}
#content .iuput_div .info-top .top-bottom button:focus {
outline: none;
color: red;
font-weight: bolder;
}
#content .iuput_div .info-middle1, #content .iuput_div .info-middle2 {
height: 288px;
text-align: center;
}
/*=============账号登录==============*/
#content .iuput_div .info-middle1 .username, #content .iuput_div .info-middle1 .password {
height: 40px;
width: auto;
position: absolute;
left: 20px;
right: 20px;
top: 40px;
}
#content .iuput_div .info-middle1 .password {
top: 110px;
}
#content .iuput_div .info-middle1 img{
float: left;
height: 100%;
border: 1px solid rgb(200,200,200);
}
#content .iuput_div .info-middle1 input{
border: 0;
float: left;
height: 100%;
width: 84.5%;
padding-left: 5px;
font-size: 20px;
border-bottom: 1px solid rgb(200,200,200);
border-top: 1px solid rgb(200,200,200);
border-right: 1px solid rgb(200,200,200);
}
#content .iuput_div .info-middle1 a {
position: absolute;
top: 180px;
right: 20px;
font-size: 12px;
color: rgb(120,120,120);
}
#content .iuput_div .info-middle1 a:hover {
color: red;
text-decoration: underline;
}
#content .iuput_div .info-middle1 button{
border: 0;
background-color: red;
color: white;
font-size: 20px;
left: 20px;
right: 20px;
width: 88%;
height: 40px;
position: absolute;
bottom: 25px;
}
/*=============扫码登录==============*/
#content .iuput_div .info-middle2 .erwei{
top: 30px;
height: 175px;
}
#content .iuput_div .info-middle2 .message{
font-size: 10px;
height: 20px;
top: 30px;
}
#content .iuput_div .info-middle2 .td{
top: 40px;
height: 35px;
}
#content .iuput_div .info-bottom {
height: 50px;
border-top: 1px solid rgb(240,240,240);
line-height: 50px;
}
#content .iuput_div .info-bottom .left-bottom {
position: absolute;
left: 20px;
float: left;
}
#content .iuput_div .info-bottom .left-bottom img {
float: left;
top: 12.5px;
}
#content .iuput_div .info-bottom .left-bottom p {
display: inline-block;
font-family: "arial narrow";
padding-left: 3px;
padding-right: 6px;
float: left;
}
#content .iuput_div .info-bottom .left-bottom a {
color: black;
}
#content .iuput_div .info-bottom .left-bottom a:hover {
text-decoration: underline;
color: red;
}
#content .iuput_div .info-bottom .left-bottom font {
float: left;
padding-right: 10px;
}
#content .iuput_div .info-bottom .right-bottom {
position: absolute;
right: 20px;
float: left;
}
#content .iuput_div .info-bottom .right-bottom img {
float: left;
top: 12.5px;
}
#content .iuput_div .info-bottom .right-bottom p {
display: inline-block;
font-size: 18px;
color: red;
padding-left: 3px;
padding-right: 5px;
float: left;
}
#content .iuput_div .info-bottom .right-bottom a {
color: red;
}
#content .iuput_div .info-bottom .right-bottom a:hover {
text-decoration: underline;
}
/*=============3.footer============*/
#footer {
width: 100%;
height: 86px;
text-align: center;
}
#footer p {
font-size: 12px;
margin-top: 15px;
color: rgb(80,80,80);
}
#footer a {
font-size: 12px;
color: rgb(80,80,80);
text-decoration: none;
margin-left: 15px;
margin-right: 15px;
}
#footer a:hover {
color: red;
text-decoration: underline;
}
/*==============4.悬浮窗===========*/
.xf {
text-align: center;
font-size: 12px;
color: white;
position: fixed;
bottom: 30px;
right: 20px;
width: 90px;
height: 40px;
line-height: 40px;
background-color: darkred;
border-radius: 10px;
z-index: 2;
}
/* --- jdjm.html --- */
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>京东-欢迎登陆</title>
<!-- 设置网页图标
rel:icon(设置图标)
type:文件类型 image/图片类型
-->
<link rel="icon" type="image/icon" href="img/icon.ico"/>
<link rel="stylesheet" type="text/css" href="css/jd.css"/>
<script type="text/javascript">
function zhegai(){
document.getElementById("yc").style.display = "block"
}
function huihuan(){
document.getElementById("yc").style.display = "none"
}
function sm(){
document.getElementById("m1").style.display = "none"
document.getElementById("m2").style.display = "block"
}
function zh(){
document.getElementById("m1").style.display = "block"
document.getElementById("m2").style.display = "none"
}
function sjk(){
document.getElementById("sj").style.display = "inline"
}
function sjg(){
document.getElementById("sj").style.display = "none"
}
</script>
</head>
<body>
<div style="position:relative; width: 100%;">
<div id="yc" style="position: absolute; z-index: 999; width: 100%; height: 720px; background-color: rgba(160,160,160,0.5); display: none;">
<img src="img/warning.png" style="position: absolute; top: 10px; right: 10px;" onclick="huihuan()"/>
</div>
<div style="position: absolute; z-index: 1; width: 100%;">
<!--=====1.顶部=====-->
<div id="header">
<div class="h-top">
<!-- 顶部图标 -->
<div class="icon">
<a href="http://www.jindong.com"><img src="img/logo.png" /></a>
<img src="img/l-icon.png" />
</div>
<!--问卷-->
<a class="a1" href="https://surveys.jd.com/index.php?r=survey/index/sid/568245/lang/zh-Hans">登录页面,调查问卷</a>
</div>
<div class="h-bottom">
<img src="img/warning.png" /><p>依据《网络安全法》,为保障您的账户安全和正常使用,请尽快完成手机号验证! 新版《京东隐私政策》已上线,将更有利于保护您的个人隐私。</p>
</div>
</div>
<!--=====2.中间内容=====-->
<div id="content">
<div class="iuput_div">
<div class="info-top">
<div class="top-top">
<img src="img/warning.png" />
<p>京东不会以任何理由要求您转账汇款,谨防诈骗。</p>
</div>
<div class="top-bottom">
<button onfocus="sm()">扫码登录</button> <font style="color: rgb(230,230,230);">|</font>
<button onfocus="zh()">账户登录</button>
</div>
</div>
<div class="info-middle1" id="m1" style="display: block;">
<div class="username">
<img src="img/pygame.png"/>
<input type="text" name="username" id="username" placeholder="邮箱/用户名/已验证手机" />
</div>
<div class="password">
<img src="img/password_icon.png"/>
<input type="password" name="password" id="password" placeholder="密码" />
</div>
<a href="https://safe.jd.com/findPwd/index.action">忘记密码</a>
<button>登 录</button>
</div>
<div class="info-middle2" id="m2" style="display: none;">
<div class="erwei">
<img src="img/二维码.png" onmouseover="sjk()" onmouseout="sjg()"/>
<img id="sj" src="img/sj.png" style="display: none;"/>
</div>
<div class="message">
打开<font style="color: red;">手机京东</font> 扫码二维码
</div>
<div class="td">
<img src="img/tb_看图王.png" />
</div>
</div>
<div class="info-bottom">
<div class="left-bottom">
<img src="img/qq.png"/><p><a href="https://graph.qq.com/oauth2.0/show?which=Login&display=pc&response_type=code&state=0B7A83EC30038165ABCFD2349EAA001B230A17C287D34D34ED0F5481A5E2BEE533746EE13579F883D8DBE4F085528F06&client_id=100273020&redirect_uri=https%3A%2F%2Fqq.jd.com%2Fnew%2Fqq%2Fcallback.action%3Fview%3Dnull%26uuid%3D637e1e504c8f49408701b645a6027f91">QQ</a></p>
<font style="color: rgb(200,200,200);">|</font>
<img src="img/weixin.png"/><p><a href="https://open.weixin.qq.com/connect/qrconnect?appid=wx827225356b689e24&state=AC38521B23395EEFAED7F6EE1F1764F112E70562EAA04979830534716719DB3E80CBF6E591ECDA7EA35A755485C92AA3&redirect_uri=https%3A%2F%2Fqq.jd.com%2Fnew%2Fwx%2Fcallback.action%3Fview%3Dnull%26uuid%3D4a92aca675cd4dffba22f21583f45531&response_type=code&scope=snsapi_login#wechat_redirect">微信</a></p>
</div>
<div class="right-bottom">
<img src="img/right.png"/><p><a href="https://reg.jd.com/reg/person?ReturnUrl=http%3A%2F%2Fwww.jd.com">立即注册</a></p>
</div>
</div>
</div>
</div>
<!--=====3.底部=====-->
<div id="footer">
<p><a href="https://www.jd.com/">关于我们</a> |
<a href="http://about.jd.com/contact">联系我们</a> |
<a href="http://zhaopin.jd.com/home;jsessionid=D161F103FAE9E70A38DA58068501F701.s1">人才招聘</a> |
<a href="https://www.jd.com/">商家入驻</a> |
<a href="https://www.jd.com/">广告服务</a> |
<a href="https://app.jd.com/">手机京东</a> |
<a href="https://club.jd.com/links.aspx">友情链接</a> |
<a href="https://media.jd.com/">销售联盟</a> |
<a href="https://sale.jd.com/act/n0hAvqy5CW8.html">京东社区</a> |
<a href="https://gongyi.jd.com/">京东公益</a> |
<a href="https://www.joybuy.com/">English Site</a></p>
<p>Copyright © 2004-2018 京东JD.com 版权所有</p>
</div>
</div>
<div class="xf" onclick="zhegai()">遮盖层</div>
</div>
</body>
</html>
效果:
大图:
遮盖层的应用:是其他网页元素处于无法操作的情况