CSS九宮格抽獎是一種通過CSS樣式設計九宮格布局,實現抽獎效果的網頁設計。使用CSS來創建隨機生成的布局,讓用戶在頁面上隨機選擇中獎元素。
下面是一個簡單的CSS九宮格抽獎示例:
#random-box {
width: 300px;
height: 300px;
background-color: #fff;
box-shadow: 0px 0px 10px rgba(0,0,0,0.2);
border-radius: 5px;
margin: 10px auto;
padding: 10px;
text-align: center;
#box-1 {
background-color: #007bff;
color: #fff;
padding: 10px;
border-radius: 5px;
margin: 0 10px;
transition: background-color 0.3s ease;
#box-2 {
background-color: #0069d9;
color: #fff;
padding: 10px;
border-radius: 5px;
margin: 0 10px;
transition: background-color 0.3s ease;
#box-3 {
background-color: #00618f;
color: #fff;
padding: 10px;
border-radius: 5px;
margin: 0 10px;
transition: background-color 0.3s ease;
#box-4 {
background-color: #005d68;
color: #fff;
padding: 10px;
border-radius: 5px;
margin: 0 10px;
transition: background-color 0.3s ease;
#box-5 {
background-color: #005056;
color: #fff;
padding: 10px;
border-radius: 5px;
margin: 0 10px;
transition: background-color 0.3s ease;
#box-6 {
background-color: #004f4e;
color: #fff;
padding: 10px;
border-radius: 5px;
margin: 0 10px;
transition: background-color 0.3s ease;
#box-7 {
background-color: #004745;
color: #fff;
padding: 10px;
border-radius: 5px;
margin: 0 10px;
transition: background-color 0.3s ease;
#box-8 {
background-color: #004141;
color: #fff;
padding: 10px;
border-radius: 5px;
margin: 0 10px;
transition: background-color 0.3s ease;
#box-9 {
background-color: #003e3c;
color: #fff;
padding: 10px;
border-radius: 5px;
margin: 0 10px;
transition: background-color 0.3s ease;
#box-10 {
background-color: #003332;
color: #fff;
padding: 10px;
border-radius: 5px;
margin: 0 10px;
transition: background-color 0.3s ease;
#box-11 {
background-color: #002f28;
color: #fff;
padding: 10px;
border-radius: 5px;
margin: 0 10px;
transition: background-color 0.3s ease;
#box-12 {
background-color: #002624;
color: #fff;
padding: 10px;
border-radius: 5px;
margin: 0 10px;
transition: background-color 0.3s ease;
#box-13 {
background-color: #002221;
color: #fff;
padding: 10px;
border-radius: 5px;
margin: 0 10px;
transition: background-color 0.3s ease;
#box-14 {
background-color: #001b1d;
color: #fff;
padding: 10px;
border-radius: 5px;
margin: 0 10px;
transition: background-color 0.3s ease;
#box-15 {
background-color: #001a19;
color: #fff;
padding: 10px;
border-radius: 5px;
margin: 0 10px;
transition: background-color 0.3s ease;
#box-16 {
background-color: #001016;
color: #fff;
padding: 10px;
border-radius: 5px;
margin: 0 10px;
transition: background-color 0.3s ease;
#box-17 {
background-color: #000f13;
color: #fff;
padding: 10px;
border-radius: 5px;
margin: 0 10px;
transition: background-color 0.3s ease;
#box-18 {
background-color: #000d11;
color: #fff;
padding: 10px;
border-radius: 5px;
margin: 0 10px;
transition: background-color 0.3s ease;
#box-19 {
background-color: #00009c;
color: #fff;
padding: 10px;
border-radius: 5px;
margin: 0 10px;
transition: background-color 0.3s ease;
#box-20 {
background-color: #00008e;
color: #fff;
padding: 10px;
border-radius: 5px;
margin: 0 10px;
transition: background-color 0.3s ease;
#box-21 {
background-color: #000081;
color: #fff;
padding: 10px;
border-radius: 5px;
margin: 0 10px;
transition: background-color 0.3s ease;
#box-22 {
background-color: #00007f;
color: #fff;
padding: 10px;
border-radius: 5px;
margin: 0 10px;
transition: background-color 0.3s ease;
#box-23 {
background-color: #000071;
color: #fff;
padding: 10px;
border-radius: 5px;
margin: 0 10px;
transition: background-color 0.3s ease;
#box-24 {
background-color: #00006f;
color: #fff;
padding: 10px;
border-radius: 5px;
margin: 0 10px;
transition: background-color 0.3s ease;
#box-25 {
background-color: #000069;
color: #fff;
padding: 10px;
border-radius: 5px;
margin: 0 10px;
transition: background-color 0.3s ease;
#box-26 {
background-color: #000060;
color: #fff;
padding: 10 10px;
border-radius: 5px;
transition: background-color 0.3s ease;
#box-27 {
background-color: #000 ;
#box-27:hover {
background-color: #00