今天中午空闲之余写了个拖动拼图!感觉还不错!(拼图游戏)

开始游戏 重新游戏

//CSS样式!(不要把事情想的很复杂 其实很简单!) *{ margin: 0; padding: 0; box-sizing: border-box; }

.box{
width: 550px;
margin: 0 auto;
}

.box table{
width: 540px;
margin: 0 auto;
}

.box table td{
width: 168px;
height: 168px;
background-image: url(…/img/all.jpg);
background-repeat: no-repeat;
}

.box table td.img0{
background-position: 0 0;
}
.box table td.img1{
background-position: -168px 0;
}
.box table td.img2{
background-position: -336px 0;
}
.box table td.img3{
background-position: 0 -168px;
}
.box table td.img4{
background-position: -168px -168px;
}
.box table td.img5{
background-position: -336px -168px;
}
.box table td.img6{
background-position: 0 -336px;
}
.box table td.img7{
background-position: -168px -336px;
}
.box table td.img8{
background-position: -336px -336px;
}

你可能感兴趣的:(前端js,javascript)