<!DOCTYPE HTML PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>inline-block</title>
<style type="text/css">
body {
font-family: verdana;
font-size: 12px;
}
</style>
</head>
<body>
<div style="height:400px;background:red" >
</div>
<span style="top:50%;position:relative">1</span>
</body>
</html>
以上是代码一
<!DOCTYPE HTML PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>inline-block</title>
<style type="text/css">
body {
font-family: verdana;
font-size: 12px;
}
</style>
</head>
<body>
<div style="height:400px;background:red" >
</div>
<span style="top:50%;position:absolute">1</span>
</body>
</html>
以上是代码二
代码一 span的内容和代码二的位置不同,为什么呢