jsp和css格式化

时间:2015-07-17 17:48:20

标签: css jsp

所以基本上我是在格式化代码,而且间距不是id的格式,但颜色是,为什么它会拾取其中一个格式化元素而不是其他元素。

jsp代码

   <%@ page language="java" contentType="text/html; charset=ISO-8859-1" 
pageEncoding="ISO-8859-1"%>
<!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=ISO-8859-1">
<script type="text/javascript" src="/web_project1/jquery/jquery-1.4.2.js">
</script>
<script type="text/javascript" src="functions.js"></script> 
<link type="text/css" rel="Stylesheet" href="Stylesheet.css"/>
<title>Sam's Game</title>
</head>
<body>
<h1 class="format" id="title">Sam's Game</h1>
<h1 id="you">You <span id="enemy">Opponent</span></h1>
<h1 id="stats">Stats:<span id="theirStats">Stats:</span></h1>
</body>
</html>

我的css文件

@CHARSET "ISO-8859-1";
#title {
font-family: Snap ITC, chiller;
font-size: 50px;
color:red;
text-align:center;
}
.format{
background-color:yellow;
margin-left: 480px;
width:360px;
height:60px; 
}
#you {
margin-left:150px;
font-family:verdana;
color:blue;
font-size:25px;

}
#enemy{
margin-left:850px;
font-family:verdana;
color:blue;
font-size:25px;

}
#stats{
margin-left: 90;
font-family: comic;
color:green;

}
#theirStats{
margin-left: 800;
font-family: comic;
color:green;

}

我可能错过了一些简单的东西,但无论如何,边距左边应该添加间距看起来像

Stats:                                               Stats:

但它目前正在出现

Stats:Stats:

^^目前是绿色字体

1 个答案:

答案 0 :(得分:0)

尝试margin-left: 90pxmargin-left: 800px代替margin-left: 90margin-left: 800

试试这个..

@CHARSET "ISO-8859-1";
#title {
font-family: Snap ITC, chiller;
font-size: 50px;
color:red;
text-align:center;
}
.format{
background-color:yellow;
margin-left: 480px;
width:360px;
height:60px; 
}
#you {
margin-left:150px;
font-family:verdana;
color:blue;
font-size:25px;

}
#enemy{
margin-left:850px;
font-family:verdana;
color:blue;
font-size:25px;

}
#stats{
margin-left: 90px;
font-family: comic;
color:green;

}
#theirStats{
margin-left: 800px;
font-family: comic;
color:green;

}
<h1 class="format" id="title">Sam's Game</h1>
<h1 id="you">You <span id="enemy">Opponent</span></h1>
<h1 id="stats">Stats:<span id="theirStats">Stats:</span></h1>

查看此Fiddle