基于基于javascript制作经典传统的拼图游戏制作经典传统的拼图游戏
主要为大家详细介绍了基于javascript制作拼图游戏的相关内容,经典传统的拼图游戏是大家最喜爱的游戏之
一,具有挑战性,感兴趣的小伙伴们可以参考一下
本文实例为大家分享了javascript制作经典传统的拼图游戏的关键代码,供大家参考,具体内容如下
效果图:
拼出你喜欢的白雪公主和七个小矮人
实现代码:
<!DOCTYPE html>
<html>
<head>
<title>pingtu.html</title>
<meta http-equiv="keywords" content="keyword1,keyword2,keyword3">
<meta http-equiv="description" content="this is my page">
<meta http-equiv="content-type" content="text/html; charset=gb2312">
<!--<link rel="stylesheet" type="text/css" href="./styles.css">-->
<style type="text/css">
*{ margin-bottom:0px;
margin-top: 0px;
margin-left: 0px;
margin-right: 0px;
padding-right: 0px;
padding-left: 0px;
padding-top: 0px;
padding-bottom: 0px;
border: 0px;
}
#box{
position:absolute;
top:0px;
left:0px;
width: 300px;
height: 300px;
border: 1px solid red;
}
#box img{
float:left;
width: 100px;
height: 100px;
}
#box .pj,#box .p2,#box .p3,#box .p4,#box .p5,#box .p6,#box .p7,#box .p8,#box .p9{
position: absolute;
}
#box .pj,#box .p2,#box .p3{
top:0px;
}
#box .p4,#box .p5,#box .p6{
top:100px;
}
#box .p7,#box .p8,#box .p9{
top:200px;
}
#box .pj,#box .p4,#box .p7{
left:0px;
}
#box .p2,#box .p5,#box .p8{
left:100px;
}