本文实例为大家分享了js贪吃蛇小游戏demo,纯js和css完成,供大家参考,具体内容如下
*{ margin: 0; padding:0; } .content{ position: absolute; width: 500px; height: 500px; background-color: #212121; } .colo{ width: 48px; height: 48px; background-color: #E6E6E6; border: 1px solid #466F85; float: left; } .head{ background-image: url(./img/22.jpg); border-radius: 10px; background-size: 100%; position: absolute; height: 48px; width: 48px; } .fruit{ background-image: url(./img/fruit.jpg); background-size: 100%; position: absolute; height: 48px; width: 48px; } .score{ font-family: '黑体'; left:600px; position: absolute; height: 50px; width: 200px; background-color: #212121; color: #FFF; } .newbody{ position: absolute; width: 48px; height: 48px; background-image: url(./img/33.jpg); background-size: 100%; } .btn{ font-family: '黑体'; left:600px; top: 100px; position: absolute; height: 50px; width: 100px; background-color: #1193FF; color: #FFF; text-align: center; line-height: 50px; font-size: 20px; cursor: pointer; border-radius: 15px; } 停止游戏 开启游戏 游戏状态: 分数:
还在不断完善中,希望对大家的学习有所帮助。
以上就是本文的全部内容,希望对大家的学习有所帮助,也希望大家多多支持考高分网。



