HTML心形立體代碼
<!DOCTYPE html> <html> <head> <title>心形立體代碼</title> <style> body { background-color: #ffffff; } /* 畫一個四邊形 */ #base { position: absolute; left: 50%; top: 50%; margin-top: -50px; margin-left: -50px; height: 100px; width: 100px; background-color: red; transform-style: preserve-3d; transform: rotateX(-30deg) rotateY(0deg) rotateZ(45deg); } /* 畫出左上、右下的半圓 */ #topleft, #bottomright { position: absolute; height: 70px; width: 70px; border-radius: 50%; background-color: pink; transform-style: preserve-3d; transform: rotateX(30deg) rotateY(45deg) rotateZ(0deg); } /* 畫出右上、左下的三角形 */ #topright, #bottomleft { position: absolute; height: 0; width: 0; border-left: 35px solid transparent; border-right: 35px solid transparent; transform-style: preserve-3d; transform: rotateX(-30deg) rotateY(-135deg) rotateZ(0deg); } #topright { top: -35px; left: 35px; border-bottom: 60px solid pink; } #bottomleft { top: 65px; left: -35px; border-top: 60px solid pink; } </style> </head> <body> <div id="base"></div> <div id="topleft"></div> <div id="topright"></div> <div id="bottomleft"></div> <div id="bottomright"></div> </body> </html>
以上是一個用HTML實現(xiàn)的心形立體代碼。我們可以將其復(fù)制粘貼到記事本或其他文本編輯器中來查看效果。