#精品
WordPress博客新增春节红灯笼挂件

2021-08-01 0 919 百度已收录

WordPress博客新增春节红灯笼挂件
      春节将至!过年啦,挂灯笼!自己博客也是自己的家,迎接春节节日气氛!代码这里也分享一下,有喜欢的朋友拿去用,将灯笼挂在自己的博客上,增加点过年的气氛。

使用截图(单边红灯笼)下面有两边挂双侧灯笼教程!!!!!!

WordPress博客新增春节红灯笼挂件

1.添加HTML代码

将下面的HTML代码添加到主题页脚模板footer.php,</body>标签的上面。

  1. <!– 灯笼1 –>
  2. <div class=“deng-box”>
  3. <div class=“deng”>
  4. <div class=“xian”></div>
  5. <div class=“deng-a”>
  6. <div class=“deng-b”><div class=“deng-t”></div></div>
  7. </div>
  8. <div class=“shui shui-a”><div class=“shui-c”></div><div class=“shui-b”></div></div>
  9. </div>
  10. </div>
  11.  
  12. <!– 灯笼2 –>
  13. <div class=“deng-box1”>
  14. <div class=“deng”>
  15. <div class=“xian”></div>
  16. <div class=“deng-a”>
  17. <div class=“deng-b”><div class=“deng-t”></div></div>
  18. </div>
  19. <div class=“shui shui-a”><div class=“shui-c”></div><div class=“shui-b”></div></div>
  20. </div>
  21. </div>

2.添加样式

将样式代码添加到WP后台 → 外观 → 自定义 → 额外CSS 中,点击“发布”即可!

  1. .dengbox {
  2. position: fixed;
  3. top: 40px;
  4. right: 20px;
  5. zindex: 999;
  6. }
  7.  
  8. .dengbox1 {
  9. position: fixed;
  10. top: 30px;
  11. right: 10px;
  12. zindex: 999;
  13. }
  14.  
  15. .dengbox1 .deng {
  16. position: relative;
  17. width: 120px;
  18. height: 90px;
  19. margin: 50px;
  20. background: #d8000f;
  21. background: rgba(216, 0, 15, 0.8);
  22. borderradius: 50% 50%;
  23. webkittransformorigin: 50% 100px;
  24. webkitanimation: swing 5s infinite easeinout;
  25. boxshadow: 5px 5px 30px 4px rgba(252, 144, 61, 1);
  26. }
  27.  
  28. .deng {
  29. position: relative;
  30. width: 120px;
  31. height: 90px;
  32. margin: 50px;
  33. background: #d8000f;
  34. background: rgba(216, 0, 15, 0.8);
  35. borderradius: 50% 50%;
  36. webkittransformorigin: 50% 100px;
  37. webkitanimation: swing 3s infinite easeinout;
  38. boxshadow: 5px 5px 50px 4px rgba(250, 108, 0, 1);
  39. }
  40.  
  41. .denga {
  42. width: 100px;
  43. height: 90px;
  44. background: #d8000f;
  45. background: rgba(216, 0, 15, 0.1);
  46. margin: 12px 8px 8px 10px;
  47. borderradius: 50% 50%;
  48. border: 2px solid #dc8f03;
  49. }
  50.  
  51. .dengb {
  52. width: 45px;
  53. height: 90px;
  54. background: #d8000f;
  55. background: rgba(216, 0, 15, 0.1);
  56. margin: 4px 8px 8px 26px;
  57. borderradius: 50% 50%;
  58. border: 2px solid #dc8f03;
  59. }
  60.  
  61. .xian {
  62. position: absolute;
  63. top: 20px;
  64. left: 60px;
  65. width: 2px;
  66. height: 20px;
  67. background: #dc8f03;
  68. }
  69.  
  70. .shuia {
  71. position: relative;
  72. width: 5px;
  73. height: 20px;
  74. margin: 5px 0 0 59px;
  75. webkitanimation: swing 4s infinite easeinout;
  76. webkittransformorigin: 50% 45px;
  77. background: #ffa500;
  78. borderradius: 0 0 5px 5px;
  79. }
  80.  
  81. .shuib {
  82. position: absolute;
  83. top: 14px;
  84. left: 2px;
  85. width: 10px;
  86. height: 10px;
  87. background: #dc8f03;
  88. borderradius: 50%;
  89. }
  90.  
  91. .shuic {
  92. position: absolute;
  93. top: 18px;
  94. left: 2px;
  95. width: 10px;
  96. height: 35px;
  97. background: #ffa500;
  98. borderradius: 0 0 0 5px;
  99. }
  100.  
  101. .deng:before {
  102. position: absolute;
  103. top: 7px;
  104. left: 29px;
  105. height: 12px;
  106. width: 60px;
  107. content: ” “;
  108. display: block;
  109. zindex: 999;
  110. borderradius: 5px 5px 0 0;
  111. border: solid 1px #dc8f03;
  112. background: #ffa500;
  113. background: lineargradient(to right, #dc8f03, #ffa500, #dc8f03, #ffa500, #dc8f03);
  114. }
  115.  
  116. .deng:after {
  117. position: absolute;
  118. bottom: 7px;
  119. left: 10px;
  120. height: 12px;
  121. width: 60px;
  122. content: ” “;
  123. display: block;
  124. marginleft: 20px;
  125. borderradius: 0 0 5px 5px;
  126. border: solid 1px #dc8f03;
  127. background: #ffa500;
  128. background: lineargradient(to right, #dc8f03, #ffa500, #dc8f03, #ffa500, #dc8f03);
  129. }
  130.  
  131. .dengt {
  132. fontfamily: 华文行楷,Arial,Lucida Grande,Tahoma,sansserif;
  133. fontsize: 3.2rem;
  134. color: #dc8f03;
  135. fontweight: bold;
  136. lineheight: 85px;
  137. textalign: center;
  138. }
  139.  
  140. .night .dengt,
  141. .night .dengbox,
  142. .night .dengbox1 {
  143. background: transparent !important;
  144. }
  145.  
  146. @-mozkeyframes swing {
  147. 0% {
  148. moztransform: rotate(-10deg)
  149. }
  150.  
  151. 50% {
  152. moztransform: rotate(10deg)
  153. }
  154.  
  155. 100% {
  156. moztransform: rotate(-10deg)
  157. }
  158. }
  159.  
  160. @-webkitkeyframes swing {
  161. 0% {
  162. webkittransform: rotate(-10deg)
  163. }
  164.  
  165. 50% {
  166. webkittransform: rotate(10deg)
  167. }
  168.  
  169. 100% {
  170. webkittransform: rotate(-10deg)
  171. }
  172. }

(自行需求)如果只想在首页显示灯笼,可以用下面的判断语句把HTML代码包裹起来:

  1. <?php if (is_home()) { ?>
  2. <!– 代码放这里 –>
  3. <?php } ?>

 

给自己网站两边挂上双侧大红灯笼

 

使用截图(双边红灯笼)

WordPress博客新增春节红灯笼挂件

1.添加HTML代码

复制下面的代码到footer.php,同之前的,</body>之前

  1. <div class=“deng-box”>
  2. <div class=“deng”>
  3. <div class=“xian”></div>
  4. <div class=“deng-a”>
  5. <div class=“deng-b”><div class=“deng-t”>春节</div></div>
  6. </div>
  7. <div class=“shui shui-a”><div class=“shui-c”></div><div class=“shui-b”></div></div>
  8. </div>
  9. </div>
  10.  
  11. <div class=“deng-box1”>
  12. <div class=“deng”>
  13. <div class=“xian”></div>
  14. <div class=“deng-a”>
  15. <div class=“deng-b”><div class=“deng-t”>快乐</div></div>
  16. </div>
  17. <div class=“shui shui-a”><div class=“shui-c”></div><div class=“shui-b”></div></div>
  18. </div>
  19. </div>

2.将下面这个复制到style.css里面,WordPress可以这样:自定义——额外css,复制粘贴发布即可

  1. .dengbox {
  2. position: fixed;
  3. top: 30px;
  4. left: 220px;
  5. zindex: 9999;
  6. pointerevents: none;
  7. }
  8. .dengbox1 {
  9. position: fixed;
  10. top: 30px;
  11. right: 222px;
  12. zindex: 9999;
  13. pointerevents: none;
  14. }
  15.  
  16. .dengbox1 .deng {
  17. position: relative;
  18. width: 120px;
  19. height: 90px;
  20. margin: 50px;
  21. background: #d8000f;
  22. background: rgba(216, 0, 15, 0.8);
  23. borderradius: 50% 50%;
  24. webkittransformorigin: 50% 100px;
  25. webkitanimation: swing 5s infinite easeinout;
  26. boxshadow: 5px 5px 30px 4px rgba(252, 144, 61, 1);
  27. }
  28.  
  29. .deng {
  30. position: relative;
  31. width: 120px;
  32. height: 90px;
  33. margin: 50px;
  34. background: #d8000f;
  35. background: rgba(216, 0, 15, 0.8);
  36. borderradius: 50% 50%;
  37. webkittransformorigin: 50% 100px;
  38. webkitanimation: swing 3s infinite easeinout;
  39. boxshadow: 5px 5px 50px 4px rgba(250, 108, 0, 1);
  40. }
  41.  
  42. .denga {
  43. width: 100px;
  44. height: 90px;
  45. background: #d8000f;
  46. background: rgba(216, 0, 15, 0.1);
  47. margin: 12px 8px 8px 10px;
  48. borderradius: 50% 50%;
  49. border: 2px solid #dc8f03;
  50. }
  51.  
  52. .dengb {
  53. width: 45px;
  54. height: 90px;
  55. background: #d8000f;
  56. background: rgba(216, 0, 15, 0.1);
  57. margin: 2px 8px 8px 26px;
  58. borderradius: 50% 50%;
  59. border: 2px solid #dc8f03;
  60. }
  61.  
  62. .xian {
  63. position: absolute;
  64. top: 20px;
  65. left: 60px;
  66. width: 2px;
  67. height: 20px;
  68. background: #dc8f03;
  69. }
  70.  
  71. .shuia {
  72. position: relative;
  73. width: 5px;
  74. height: 20px;
  75. margin: 5px 0 0 59px;
  76. webkitanimation: swing 4s infinite easeinout;
  77. webkittransformorigin: 50% 45px;
  78. background: #ffa500;
  79. borderradius: 0 0 5px 5px;
  80. }
  81.  
  82. .shuib {
  83. position: absolute;
  84. top: 14px;
  85. left: 2px;
  86. width: 10px;
  87. height: 10px;
  88. background: #dc8f03;
  89. borderradius: 50%;
  90. }
  91.  
  92. .shuic {
  93. position: absolute;
  94. top: 18px;
  95. left: 2px;
  96. width: 10px;
  97. height: 35px;
  98. background: #ffa500;
  99. borderradius: 0 0 0 5px;
  100. }
  101.  
  102. .deng:before {
  103. position: absolute;
  104. top: 7px;
  105. left: 29px;
  106. height: 12px;
  107. width: 60px;
  108. content: ” “;
  109. display: block;
  110. zindex: 999;
  111. borderradius: 5px 5px 0 0;
  112. border: solid 1px #dc8f03;
  113. background: #ffa500;
  114. background: lineargradient(to right, #dc8f03, #ffa500, #dc8f03, #ffa500, #dc8f03);
  115. }
  116.  
  117. .deng:after {
  118. position: absolute;
  119. bottom: 7px;
  120. left: 10px;
  121. height: 12px;
  122. width: 60px;
  123. content: ” “;
  124. display: block;
  125. marginleft: 20px;
  126. borderradius: 0 0 5px 5px;
  127. border: solid 1px #dc8f03;
  128. background: #ffa500;
  129. background: lineargradient(to right, #dc8f03, #ffa500, #dc8f03, #ffa500, #dc8f03);
  130. }
  131.  
  132. .dengt {
  133. fontfamily: 华文行楷,Arial,Lucida Grande,Tahoma,sansserif;
  134. fontsize: 1.5rem;
  135. color: #ffa500;
  136. fontweight: bold;
  137. lineheight: 42px;
  138. textalign: center;
  139. width: 25px;
  140. margin: 0 auto;
  141. }
  142.  
  143. .night .dengt,
  144. .night .dengbox,
  145. .night .dengbox1 {
  146. background: transparent !important;
  147. }
  148.  
  149. @-mozkeyframes swing {
  150. 0% {
  151. moztransform: rotate(-10deg)
  152. }
  153.  
  154. 50% {
  155. moztransform: rotate(10deg)
  156. }
  157. 100% {
  158. moztransform: rotate(-10deg)
  159. }
  160. }
  161.  
  162. @-webkitkeyframes swing {
  163. 0% {
  164. webkittransform: rotate(-10deg)
  165. }
  166.  
  167. 50% {
  168. webkittransform: rotate(10deg)
  169. }
  170.  
  171. 100% {
  172. webkittransform: rotate(-10deg)
  173. }
  174. }

(自行需求)不想在手机端显示,将这串代码复制加到上面CSS后面即可!

  1. @media (maxwidth: 678px){.dengbox{display:none;}}
  2. @media (maxwidth: 678px){.dengbox1{display:none;}}

 

收藏 (0) 打赏

感谢您的支持,我会继续努力的!

打开微信/支付宝扫一扫,即可进行扫码打赏哦,分享从这里开始,精彩与您同在
点赞 (0)

免责声明   ⚠️ 1. 本站所有资源来源于网络收集,若资源侵犯了您的合法权益, 请来信通知我们(Email: 1427707223@qq.com),我们会及时删除,给您带来的不便,我们深表歉意! 2. 分享目的仅供大家学习和交流,若使用商业用途,请购买正版授权! 否则产生的一切后果将由下载用户自行承担! 3. 会员不得使用于非法商业用途,不得违反国家法律。否则后果自负! 4. 本站提供的源码、模板、插件等等其他资源,都不包含技术服务请大家谅解! 5. 本站资源售价只是赞助,收取费用仅维持本站的日常运营所需! 6. 因源码具有可复制性,一经购买 ,不得以任何形式退款。 7.更多详情请点击查看

优站网 WordPress WordPress博客新增春节红灯笼挂件 https://www.zhanceo.com/14491.html

诚乃立身之本、信为道德之基

常见问题
  • 如果付款后没有弹出下载页面,多刷新几下,有问题联系客服!
查看详情
  • 本站所有资源版权均属于原作者所有,这里所提供资源均只能用于参考学习用,请勿直接商用。若由于商用引起版权纠纷,一切责任均由使用者承担。
查看详情

相关文章

联系官方客服

为您解决烦忧 - 24小时在线 专业服务

WordPress博客新增春节红灯笼挂件-海报