css3卡通仙人掌仙人球图形特效
css3卡通仙人掌仙人球图形特效
html:
<div class="plants"> <div class="plant "> <div class="leaves plant-1"> <div class="limb"></div> </div> </div> <div class="plant plant-2"> <div class="leaves plant-2"> </div> </div> <div class="plant"> <div class="leaves plant-3"> </div> </div> <div class="plant plant-2"> <div class="leaves plant-4"> </div> </div> </div>
css:
* { margin: 0; padding: 0; box-sizing: border-box; } *:before, *:after { content: ""; position: absolute; } *, *:before, *:after { box-sizing: inherit; } html, body { height: 100%; width: 100%; background: #dbf4d4; } .plants{ height: 80vh; width: 80em; max-width: 80%; position: absolute; transform: translate(-50%, -50%); top: 50%; left: 50%; display: flex; flex-direction: row; } @media only screen and (max-width: 48em){ .plants{ flex-wrap: wrap; height: 100%; } } .plant{ position: relative; width: 25%; height: 50%; display: flex; flex-direction: column; align-items: center; } .plant:before{ width: 6.25em; height: 3.75em; top: calc(52vh - 3.75em); background: #b86112; border-radius: 0 0 40px 40px; background-image: linear-gradient(to bottom, transparent 1em, #a6580d 1em, #a6580d 1.5em, transparent 1.5em); box-shadow: 0.8em 0 #c4dbbe, 0 -0.1em #c06b46; z-index: 100; } .plant:after{ width: 100%; height: 0.75em; top: 52vh; background: #bf6a45; box-shadow: #c06b46 0 0.75em 0px -0.4em, #c4dbbe 0 0.5em 0 0, #c4dbbe 0 1.25em 0 0; } @media only screen and (max-width: 48em){ .plant{ width: 50%; } .plant:after{ bottom: 4em; } } .leaves{ position: absolute; background: #568515; box-shadow: 0.8em 0 #c4dbbe; } .leaves.plant-1{ width: 2.4em; height: 8.8em; top: calc(52vh - 3.75em - 8.8em); border-radius: 4em 4em 0 0; background-image: repeating-linear-gradient(to right, #4e7816, #4e7816 0.3em, transparent 0.3em, transparent 0.6em); } .leaves.plant-1:before{ width: 2em; height: 5.6em; top: 1.6em; left: -2.8em; background: inherit; border-radius: 4em 4em 0 4em; z-index: -1; background-image: inherit; box-shadow: inherit; } .leaves.plant-1:after{ width: 1em; height: 2em; top: 5.2em; left: -1em; background: inherit; z-index: -1; } .leaves.plant-2{ width: 5.6em; height: 5.6em; top: calc(52vh - 3.75em - 4.8em); border-radius: 50%; background-size: 1.2em 1.2em, 1.2em 1.2em, 5.6em 5.6em; background-image: radial-gradient(1em 4.8em at center, #ebf9d6 3%, transparent 3%), radial-gradient(4.8em 1em at center, #ebf9d6 3%, transparent 3%), radial-gradient(5.6em 15em at center, transparent 18%, #4e7816 18%, #4e7816 40%, transparent 40%); } .leaves.plant-3{ width: 4em; height: 5.6em; top: calc(52vh - 3.75em - 4.8em); border-radius: 50% 50% 50% 50%; background-size: 0.8em 1em, 4em 4em; background-image: radial-gradient(#ebf9d6 6%, #fdfefa 6%, transparent 16%), linear-gradient(to right, #4e7816 2em, transparent 2em); } .leaves.plant-3:before{ width: 4em; height: 5.6em; background: inherit; border-radius: inherit; transform: translate(80%, -25%) rotate(45deg) scale(0.75); box-shadow: inherit; } .leaves.plant-3:after{ width: 4em; height: 5.6em; background: inherit; border-radius: inherit; transform: translate(90%, -75%) rotate(16deg) scale(0.45); z-index: -1; box-shadow: inherit; } .leaves.plant-4{ width: 3.6em; height: 8.4em; top: calc(52vh - 3.75em - 8.4em); border-radius: 50% 50% 0 0; background: #568515; background-image: repeating-linear-gradient(to right, transparent, transparent 0.8em, #4e7816 0.8em, #4e7816 1.1em, transparent 1.1em); } .leaves.plant-4:after{ width: 2.8em; height: 4.8em; bottom: 0; left: -0.8em; border-radius: 48% 48% 0 0; background: #77aa2f; box-shadow: 0.4em 0 1.2em #4e7816; background-image: inherit; }
还没有留言,还不快点抢沙发?