本文实例为大家分享了JS实现九宫格抽奖的具体代码,供大家参考,具体内容如下
上代码:
谢谢惠顾
十万元现金
谢谢惠顾
iphone11
抽奖
美的冰箱
谢谢惠顾
50元红包
谢谢惠顾
CSS样式代码:
.wrapper { width: 300px; height: 300px; display: flex; flex-flow: row wrap; position: absolute; top: 0; left: 0; right: 0; bottom: 0; margin: auto; border: 1px solid red; } .wrapper div { flex: none; width: 100px; height: 100px; box-sizing: border-box; border: 1px solid red; display: flex; align-items: center; justify-content: center; } .active { background-color: red; } .wrapper div:nth-child(5) { cursor: pointer; } .result { height: 100px; display: inline-block; position: absolute; top: 50px; left: 0; right: 0; margin: auto; text-align: center; line-height: 100px; font-size: 40px; font-weight: 700; color: #ff4400; }
JS代码:
以上就是本文的全部内容,希望对大家的学习有所帮助,也希望大家多多支持考高分网。



