css实现立体字

<!DOCTYPE html> 

<html lang="en">

<head> 

    <meta charset="UTF-8" /> 

    <meta name="viewport" content="width=device-width, initial-scale=1.0" /> 

    <title>3D Text Effect</title> 

    <style> 

        body { 

            background: green; 

        }

        h1 { 

            margin: 300px auto; 

            text-align: center; 

            color: white; 

            font-size: 8em; 

            transition: 0.5s; 

            font-family: Arial, Helvetica, sans-serif; 

        }

        h1:hover { 

            text-shadow: 0 1px 0 #ccc, 0 2px 0 #ccc, 

                0 3px 0 #ccc, 0 4px 0 #ccc, 

                0 5px 0 #ccc, 0 6px 0 #ccc, 

                0 7px 0 #ccc, 0 8px 0 #ccc, 

                0 9px 0 #ccc, 0 10px 0 #ccc, 

                0 11px 0 #ccc, 0 12px 0 #ccc, 

                0 20px 30px rgba(0, 0, 0, 0.5); 

        } 

</style> 

</head> 

<body> 

    <h1>GeeksforGeeks</h1> 

</body> 

</html>

最终效果如下:

原文地址:https://www.cnblogs.com/weixin2623670713/p/13412510.html