實現(xiàn)了點不同的登錄方式顯示不同的登錄畫面,使用了一點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>
<!-- 設(shè)置網(wǎng)頁圖標(biāo)
rel:icon(設(shè)置圖標(biāo))
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">
<!-- 頂部圖標(biāo) -->
<div class="icon">
<a ><img src="img/logo.png" /></a>
<img src="img/l-icon.png" />
</div>
<!--問卷-->
<a class="a1" >登錄頁面宜咒,調(diào)查問卷</a>
</div>
<div class="h-bottom">
<img src="img/warning.png" /><p>依據(jù)《網(wǎng)絡(luò)安全法》惠赫,為保障您的賬戶安全和正常使用,請盡快完成手機號驗證故黑! 新版《京東隱私政策》已上線儿咱,將更有利于保護您的個人隱私庭砍。</p>
</div>
</div>
<!--=====2.中間內(nèi)容=====-->
<div id="content">
<div class="iuput_div">
<div class="info-top">
<div class="top-top">
<img src="img/warning.png" />
<p>京東不會以任何理由要求您轉(zhuǎn)賬匯款,謹(jǐn)防詐騙混埠。</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 >忘記密碼</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 >QQ</a></p>
<font style="color: rgb(200,200,200);">|</font>
<img src="img/weixin.png"/><p><a >微信</a></p>
</div>
<div class="right-bottom">
<img src="img/right.png"/><p><a >立即注冊</a></p>
</div>
</div>
</div>
</div>
<!--=====3.底部=====-->
<div id="footer">
<p><a >關(guān)于我們</a> |
<a >聯(lián)系我們</a> |
<a >人才招聘</a> |
<a >商家入駐</a> |
<a >廣告服務(wù)</a> |
<a >手機京東</a> |
<a >友情鏈接</a> |
<a >銷售聯(lián)盟</a> |
<a >京東社區(qū)</a> |
<a >京東公益</a> |
<a >English Site</a></p>
<p>Copyright ? 2004-2018 京東JD.com 版權(quán)所有</p>
</div>
</div>
<div class="xf" onclick="zhegai()">遮蓋層</div>
</div>
</body>
</html>
效果:
大圖:
遮蓋層的應(yīng)用:是其他網(wǎng)頁元素處于無法操作的情況