为何css失效
在WebRoot下建立了css、jsp、image文件夹分别放置login.css,login.jsp,图片文件login.jsp代码如下<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<title>超市账单管理系统</title>
<link type="text/css" rel="stylesheet" href="../css/login.css" />
<script type="text/javascript">
function check(){
var name=document.form1.username;
var pass=document.form1.password;
if(name.value==""){
alert("用户名不能为空!");
name.value="";
name.focus();
return false;
}
if(pass.value==""){
alert("密码不能为空");
pass.value="";
pass.focus();
return false;
}
return true;
}
document.onkeydown=function(){
if(event.keycode==13){
check();
}
}
</script>
</head>
<body>
<center>
<div id="bgImage">
<form action="/project2/LoginServlet" method="post" id="loginForm" name="form1" onsubmit="return check()">
<div class="username">用户名:<input type="text" name="username" class="input_t" /></div>
<div class="userpass">密 码:<input type="password" name="password" class="input_a"/></div>
<div class="btn">
<input type="submit" class="inputB" value="登录系统"/>
<input type="reset" class="inputB" value="重填" />
</div>
</form>
</div>
</center>
</body>
</html>
login.css:
body{ margin-top:40px;
padding:0px;}
#top{padding-left:200;}
#bgImage{ background:url(../image/login.jpg);
width:1000px;
height:800px
text-align:center;}
#bgImage #loginForm .username{ margin-top:300px;
margin-left:300px;
font-size:20px;
color:#FFF;
font-weight:bold;
}
.input_t{
margin-left:5px;
width:200px;
}
.input_a{
margin-left:15px;
width:200px;
}
.userpass{ margin-top:20px;
margin-left:300px;
font-size:20px;
color:#FFF;
font-weight:bold; }
#bgImage #loginForm .btn{ padding-top:30;
margin-left:600;}
#bgImage #loginForm .btn .inputB{ background:url(../image/btn_bg.jpg);
height:30;
width:92;
border:0;
color:#FFF;
font-size:20;
font-weight:bold;
}