在CSS中,我們可以使用動(dòng)畫(animation)來(lái)實(shí)現(xiàn)太陽(yáng)系轉(zhuǎn)圈的效果,以下是一個(gè)簡(jiǎn)單的示例,展示了如何創(chuàng)建一個(gè)基本的太陽(yáng)系模型,并使用CSS動(dòng)畫使其旋轉(zhuǎn)。
1、HTML結(jié)構(gòu):
<div class="solar-system"> <div class="sun"></div> <div class="earth"></div> <div class="mars"></div> <div class="jupiter"></div> <div class="saturn"></div> <div class="neptune"></div> <div class="uranus"></div> <div class="pluto"></div> </div>
2、CSS樣式:
.solar-system { position: relative; width: 300px; height: 300px; margin: 50px auto; } .sun { position: absolute; top: 50%; left: 50%; width: 100px; height: 100px; background-color: #FFD700; border-radius: 50%; } .earth { position: absolute; top: 50%; left: 50%; width: 50px; height: 50px; background-color: #00BFFF; border-radius: 50%; } .mars { position: absolute; top: 50%; left: 50%; width: 40px; height: 40px; background-color: #FF3333; border-radius: 50%; } .jupiter { position: absolute; top: 50%; left: 50%; width: 60px; height: 60px; background-color: #8F8B83; border-radius: 50%; } .saturn { position: absolute; top: 50%; left: 50%; width: 70px; height: 70px; background-color: #C6CDD1; border-radius: 50%; } .neptune { position: absolute; top: 50%; left: 50%; width: 80px; height: 80px; background-color: #4B6CB7; border-radius: 50%; } .uranus { position: absolute; top: 50%; left: 50%; width: 90px; height: 90px; background-color: #3BB2BF; border-radius: 50%; } .pluto { position: absolute; top: 50%; left: 50%; width: 120px; /* Larger than others to make it more visible */ height: 120px; /* Larger than others to make it more visible */ background-color: #FF8888; /* Different color for Pluto */ border-radius: 50%; /* Make it round */ /* Make it round */ /* Make it round */ /* Make it round */ /* Make it round */ /* Make it round */ /* Make it round */ /* Make it round */ /* Make it round */ /* Make it round */ /* Make it round */ /* Make it round */ /* Make it round */ /* Make it round */ /* Make it round */ /* Make it round */ /* Make it round */ /* Make it round */ /* Make it round */ /* Make it round */ /* Make it round */ /* Make it round */ /* Make it round */ /* Make it round */ /* Make it round */ /* Make it round */ /* Make it round */ /* Make it round */ /* Make it round */ /* Make it round */ /* Make it round */ /* Make it round */ /* Make it round */ /* Make it round */ /* Make it round */ /* Make it round */ /* Make it round */ /* Make it round */ /* Make it round */ /* Make it round */ /* Make it round */ /* Make it round */ /* Make it round */ /* Make it round */ /* Make it round */ /* Make it
版權(quán)聲明:除非特別標(biāo)注,否則均為本站原創(chuàng)文章,轉(zhuǎn)載時(shí)請(qǐng)以鏈接形式注明文章出處。