有没有人注意到在实现appendChild方法插入元素时,边距中缺少几个像素?
对于istance:
<script>
function tryit(){
var d = document.getElementsByTagName("div")[0],
e = document.getElementsByClassName("try");
d.appendChild(e[0].cloneNode(true));
d.removeChild(e[0]);
}
</script>
<style>
body{
background-color:red;
}
div{
padding:40px;
}
.try{
margin:20px;
padding:10px;
background-color:white;
border:5px solid black;
color:blue;
}
</style>
<button onclick="tryit()">try</button>
<div>
<span class="try">hello</span>
<span class="try">hello</span>
<span class="try">hello</span>
<span class="try">hello</span>
</div>