html5+css3背景设置

杜绝花里胡哨 一切从简 静背景

style.css

body{
	background-size:100%;
}

.center2 {
    position: absolute;
    width: 300px;
    height: 200px;
    /*background: #fcc;*/
    margin: auto;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
}

.an{
	background: no-repeat scroll 0 0 rgba(0, 0, 0, 0);
	height: 20px;
	width: 200px;
}
.ans{
	background: no-repeat scroll 0 0 rgba(0, 0, 0, 0);
	height: 35px;
	width: 200px;
}

register.jsp

<%@ page language="java" contentType="text/html; charset=UTF-8"
	pageEncoding="UTF-8"%>
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>萌新注册</title>
<link rel="stylesheet" href="css/style.css"/>
</head>
</head>
<body style="background-image:url(image/beijing.jpg)">
<form action="/Saber1/register" method="post">
	
    <center class="center2">
        <input type="text" class="an" id="username" name="username"
                placeholder="Username"><br/>
        <input type="password" class="an" id="inputPassword3" name="password"
                placeholder="Password"><br/>
        <input type="password" class="an" id="inputPassword3" name="password"
                placeholder="Passwords"><br/>
        
        <label><a href="./login.jsp">已有账号?立即登录</a></label>
        <input type="submit" class="ans" name="submit" value="REGISTER">  
    </center>
</from>
</body>
</html>

login.jsp

<%@ page language="java" contentType="text/html; charset=UTF-8"
	pageEncoding="UTF-8"%>
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>绅士登录</title>
<link rel="stylesheet" href="css/style.css"/>
</head>
</head>
<body style="background-image:url(image/beijing.jpg)">
<form action="/Saber1/login" method="post">
	
    <center class="center2">
    	<div><%=request.getAttribute("loginInfo")==null?"":request.getAttribute("loginInfo")%></div>
        <input type="text" class="an" id="username" name="username"
                placeholder="Username"><br/>
        <input type="password" class="an" id="inputPassword3" name="password"
                placeholder="Password"><br/>
        
        <label><a href="./register.jsp">没有账号?立即注册</a></label>
        <input type="submit" class="ans" name="submit" value="LOGIN">  
    </center>
</from>
</body>
</html>

index.jsp

<%@ page language="java" contentType="text/html; charset=utf-8"
    pageEncoding="utf-8"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<title>首页</title>
</head>
<body>
<center>
	<div>
		<h1>欢迎</h1>
	</div>
	<div>
		<a href="./register.jsp">注册</a>
		<a href="./login.jsp">退出</a>
	</div>
</center>
</body>
</html>

我另一篇文章写的是动背景,不建议用
因为,真要放到自己的网站上,卡的要死

发布了10 篇原创文章 · 获赞 4 · 访问量 757

猜你喜欢

转载自blog.csdn.net/weixin_43701595/article/details/103583841