【css酷炫结果】纯CSS实现球形阴影结果

[复制链接]
发表于 2025-10-12 07:40:20 | 显示全部楼层 |阅读模式
想直接拿走的老板,链接放在这里:上传后更新


创作随缘,不定时更新。
创作配景

刚看到csdn出运动了,赶时间,直接上代码,令人丧气的是:运动的范畴有要求,不是发够就行,刹时意志消沉。
html结构

  1. <div class="button"></div>
复制代码
css样式

  1. .button {
  2.         background-image: url('a.gif');
  3.         border-radius: 50%;
  4.     margin: 60px;
  5.     padding: 60px;
  6.     width: 200px;
  7.     height: 200px;
  8.     box-shadow: 5px 5px 15px rgba(0, 0, 0, 0.3);
  9.     transition: all 0.3s ease;
  10. }
  11. .button:hover {
  12.     box-shadow: 10px 10px 20px rgba(0, 0, 0, 0.5);
  13. }
  14. body{
  15.     text-align: center;
  16. }
复制代码
完备代码

底子版

  1. <!DOCTYPE html><html lang="en"> <head><title>页面殊效</title><style type="text/css">.button {
  2.         background-image: url('a.gif');
  3.         border-radius: 50%;
  4.     margin: 60px;
  5.     padding: 60px;
  6.     width: 200px;
  7.     height: 200px;
  8.     box-shadow: 5px 5px 15px rgba(0, 0, 0, 0.3);
  9.     transition: all 0.3s ease;
  10. }
  11. .button:hover {
  12.     box-shadow: 10px 10px 20px rgba(0, 0, 0, 0.5);
  13. }
  14. body{
  15.     text-align: center;
  16. }
  17. </style></head><body>        <div class="button"></div>
  18. </body></html>
复制代码
进阶版(动态版)

  1. <!DOCTYPE html>
  2. <html lang="en">
  3. <head>
  4. <title>页面特效</title>
  5. <style type="text/css">
  6. .button {
  7.         background-image: url('a.gif');
  8.         border-radius: 50%;
  9.     margin: 60px;
  10.     padding: 60px;
  11.     width: 200px;
  12.     height: 200px;
  13.     box-shadow: 5px 5px 15px rgba(0, 0, 0, 0.3);
  14.     transition: all 0.3s ease;
  15.     animation: dynamic-shadow 2s infinite;
  16. }
  17. .button:hover {
  18.     box-shadow: 10px 10px 20px rgba(0, 0, 0, 0.5);
  19. }
  20. @keyframes dynamic-shadow {
  21.     0% {
  22.         box-shadow: 5px 5px 15px rgba(0, 0, 0, 0.3);
  23.     }
  24.     50% {
  25.         box-shadow: 15px 15px 25px rgba(0, 0, 0, 0.7);
  26.     }
  27.     100% {
  28.         box-shadow: 5px 5px 15px rgba(0, 0, 0, 0.3);
  29.     }
  30. }
  31. body{
  32.     text-align: center;
  33. }
  34. </style>
  35. </head>
  36. <body>
  37.         <div class="button">看我看我</div>
  38. </body>
  39. </html>
复制代码
结果图



免责声明:如果侵犯了您的权益,请联系站长,我们会及时删除侵权内容,谢谢合作!更多信息从访问主页:qidao123.com:ToB企服之家,中国第一个企服评测及商务社交产业平台。

本帖子中包含更多资源

您需要 登录 才可以下载或查看,没有账号?立即注册

×
回复

使用道具 举报

登录后关闭弹窗

登录参与点评抽奖  加入IT实名职场社区
去登录
快速回复 返回顶部 返回列表