Clifnich 2016-11-04 06:02 采纳率: 0%
浏览 916
已采纳

为什么看上去一样的两段css会有不同的输出?

大家好,我今天遇到了鬼畜。。
html里面写了个表格,外联的样式表:

 <!doctype html>
<html>
<head>
  <meta charset="utf-8">
  <title>Battleship</title>
  <link rel="stylesheet" type="text/css" href="workship.css">
</head>
<body>

  <table>
<tr>
<td id="00" class="hit"></td>
</tr>

  </table>

</html>

大家看一下我的workship.css:

 table {
margin-top: 98px;
left: 173px;
position: absolute;
border-spacing: 0px;
}

.hit {
background: url("ship.png") no-repeat center center;
}
td {
width: 94px;
height: 94px;
}

结果是我想要的位置:workship

好,大家在看一段一模一样的css:

 table {
margin-top: 98px:
left: 173px;
position: absolute;
border-spacing: 0px;
}

.hit {
background: url("ship.png") no-repeat center center;
}
td {
width: 94px;
height: 94px;
}

然后我把链接修改成到它的时候,发现页面变成了:图片说明

为什么表格的边界margin没有体现出来,而两段代码明明是一样的,确有不同的效果?

  • 写回答

8条回答 默认 最新

  • 关注

    第一段:margin-top: 98px;
    第二段:margin-top: 98px:
    ;与:的区别,打错了

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论
查看更多回答(7条)

报告相同问题?