小白前端自制紅警登陸界面(試水前端)

效果圖

在這裏插入圖片描述

代碼

一,html部分

<!DOCTYPE html>
<html>
	<head>
		<meta charset="utf-8" />
		<title></title>
		<link rel="stylesheet" type="text/css" href="css/zzh.css"/>
		<script type="text/javascript" src="js/zzh.js">		
		</script>
	</head>
	<body>
		<div class="bkg">
			<div class="login" id="login1">
				<form class="input_box">
					<ol>
						<li>				
							<label style="float: left;">用戶名</label>
							<input type="text" name="" id="" value="" />
						</li>
						<li>
							
							<label style="float: left;">密碼</label>
							<input type="password" name="" id="" value=""/>
						</li>
						<li>
							<button type="submit" class="button">登陸</button>
						</li>
					</ol>				
				</form>
			</div>
			<img class="person" src="img/person.png" id="person1" />
			<img class="log" src="img/log.png" id="log1" />
			<img class="bottom" src="img/bottom1.png"  id="bottom1"/>
		</div>
	</body>
</html>

二,css部分

*{
	margin: 0;
	padding: 0;
}

.bkg{
	position: relative;
	width: 100%;
	height: 975px;
	background-image:url(../img/bkg.jpg);
	background-repeat: no-repeat;
	background-size: cover;
}

.login{
	position: absolute;
	margin: 30px auto;
	width: 400px;
	height: 300px;
	background: rgb(192,192,192,0.3);
	left: 0;
	top: 0;
	right: 0;
	bottom: 0;
	border-radius: 6%;
	transition: 0.8s;
}
.login:hover{
	width: 430px;
}
.person{
	position: absolute;
	top: 120px;
	left: -700px;
	transition: 1.2s ease-out;
}

.log{
	float: right;
}

.input_box{
	position: relative;
	left: 0;
	right: 0;
	top: 0;
	bottom: 0;
	margin: 20px auto;
	width: 300px;
	height: 200px;
	background: rgb(192,192,192,0.1);
	text-align: center;
	border-radius: 4%;
	font-size: 20px;
}

.input_box ol li{
	display: inline-block;
	margin-top: 20px;
	list-style: none;
	
}
.input_box ol li label{
	float: left;
	width: 80px;
	height: 30px;
	line-height: 1em;
}
.input_box ol li input{
	float: left;
	width: 180px;
	height: 30px;
	text-align: left;
	line-height: 100%;
	padding: 1px 9px;
}
.button{
	margin: 0;
	padding: 0;
	border: 2px solid rgb(192,192,192,0.7);
	width: 90px;
	height: 30px;
	background: rgb(192,192,192,0.5);
	font-family: serif;
	font-size: 20px;
	letter-spacing: 6px;
	transition: 0.5s;
}
.button:hover{
	transform: scale(1.1,1.1);
}
.bottom{
	position: absolute;
	width: 100%;
	height: 0px;
	background-image:url(../img/bottom1.png);
	background-repeat: no-repeat;
	background-size: cover;
	top: 925px;
	transition: 0.8s ease-out;
}

三,js部分

window.onload = function(){
	var login = document.getElementById("login1");
	var person = document.getElementById("person1");
	var bottom = document.getElementById("bottom1");
	login.onmouseover = function(){
		
			person.style.left = 0;
			bottom.style.height = "50px";
			
		
	}
	login.onmouseout = function(){
		
			person.style.left = "-700px";
			bottom.style.height = 0;
		
	}
	
}

注:如果要複製運行這個代碼,需要注意一些圖片資源的路徑

圖片素材

bkg.jpg
在這裏插入圖片描述bottom1.png
在這裏插入圖片描述log.png
在這裏插入圖片描述
person.png
在這裏插入圖片描述
本人ps技術有限,圖可能扣的不大好,下面的是原圖,有大佬可以自己扣
在這裏插入圖片描述css動畫實現表白愛心樹落葉效果

css3動畫特效之字節跳動

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章