技术文摘

2023过年给网站加一对灯笼CSS代码

作者:雨祺   发表于:
浏览:157次    字数:5158  原创
级别: 站长   总稿: 69 篇,  月稿: 0
马上2023快过年了,给网站加一对红灯笼,这样才有过年的喜庆劲儿。灯笼是代码生成的无需图片,而且还会摆动。
使用方法:
把HTML下面代码粘贴到网页BODY内任意位子都可以。灯笼的位子可以微调.deng-box的left和right数值。
CSs与html代码:
  1.  <div class="dengl"
  2.   <div class="deng-box2"
  3.     <div class="deng"
  4.       <div class="xian"></div> 
  5.       <div class="deng-a"
  6.         <div class="deng-b"
  7.           <div class="deng-t">年</div></div> 
  8.       </div> 
  9.       <div class="shui shui-a"
  10.         <div class="shui-c"></div> 
  11.         <div class="shui-b"></div> 
  12.       </div> 
  13.     </div> 
  14.   </div> 
  15.   <div class="deng-box3"
  16.     <div class="deng"
  17.       <div class="xian"></div> 
  18.       <div class="deng-a"
  19.         <div class="deng-b"
  20.           <div class="deng-t">新</div></div> 
  21.       </div> 
  22.       <div class="shui shui-a"
  23.         <div class="shui-c"></div> 
  24.         <div class="shui-b"></div> 
  25.       </div> 
  26.     </div> 
  27.   </div> 
  28.   <div class="deng-box1"
  29.     <div class="deng"
  30.       <div class="xian"></div> 
  31.       <div class="deng-a"
  32.         <div class="deng-b"
  33.           <div class="deng-t">乐</div></div> 
  34.       </div> 
  35.       <div class="shui shui-a"
  36.         <div class="shui-c"></div> 
  37.         <div class="shui-b"></div> 
  38.       </div> 
  39.     </div> 
  40.   </div> 
  41.   <div class="deng-box"
  42.     <div class="deng"
  43.       <div class="xian"></div> 
  44.       <div class="deng-a"
  45.         <div class="deng-b"
  46.           <div class="deng-t">快</div></div> 
  47.       </div> 
  48.       <div class="shui shui-a"
  49.         <div class="shui-c"></div> 
  50.         <div class="shui-b"></div> 
  51.       </div> 
  52.     </div> 
  53.   </div> 
  54. </div> 
  55. <style> 
  56.     .deng-box{position:fixed;top:-40px;right:150px;z-index:9999;pointer-events:none;} .deng-box1{position:fixed;top:-30px;right:10px;z-index:9999;pointer-events:none} .deng-box2{position:fixed;top:-40px;left:150px;z-index:9999;pointer-events:none} .deng-box3{position:fixed;top:-30px;left:10px;z-index:9999;pointer-events:none} .deng-box1 .deng,.deng-box3 .deng{position:relative;width:120px;height:90px;margin:50px;background:#d8000f;background:rgba(255, 0, 0);border-radius:50% 50%;-webkit-transform-origin:50% -100px;-webkit-animation:swing 5s infinite ease-in-out;box-shadow:-5px 5px 30px 4px #fc903d}.deng{position:relative;width:120px;height:90px;margin:50px;background:#d8000f;background:rgba(255, 0, 0);border-radius:50% 50%;-webkit-transform-origin:50% -100px;-webkit-animation:swing 3s infinite ease-in-out;box-shadow:-5px 5px 50px 4px #fa6c00}.deng-a{width:100px;height:90px;background:#d8000f;background:rgba(216,0,15,.1);margin:12px 8px 8px 8px;border-radius:50% 50%;border:2px solid #dc8f03}.deng-b{width:45px;height:90px;background:#d8000f;background:rgba(216,0,15,.1);margin:-4px 8px 8px 26px;border-radius:50% 50%;border:2px solid #dc8f03}.xian{position:absolute;top:-20px;left:60px;width:2px;height:20px;background:#dc8f03}.shui-a{position:relative;width:5px;height:20px;margin:-5px 0 0 59px;-webkit-animation:swing 4s infinite ease-in-out;-webkit-transform-origin:50% -45px;background:orange;border-radius:0 0 5px 5px}.shui-b{position:absolute;top:14px;left:-2px;width:10px;height:10px;background:#dc8f03;border-radius:50%}.shui-c{position:absolute;top:18px;left:-2px;width:10px;height:35px;background:orange;border-radius:0 0 0 5px}.deng:before{position:absolute;top:-7px;left:29px;height:12px;width:60px;content:" ";display:block;z-index:999;border-radius:5px 5px 0 0;border:solid 1px #dc8f03;background:orange;background:linear-gradient(to right,#dc8f03,orange,#dc8f03,orange,#dc8f03)}.deng:after{position:absolute;bottom:-7px;left:10px;height:12px;width:60px;content:" ";display:block;margin-left:20px;border-radius:0 0 5px 5px;border:solid 1px #dc8f03;background:orange;background:linear-gradient(to right,#dc8f03,orange,#dc8f03,orange,#dc8f03)}.deng-t{font-family:黑体,Arial,Lucida Grande,Tahoma,sans-serif;font-size:3.2rem;color:#ffeb3be6;font-weight:700;line-height:85px;text-align:center}.night .deng-box,.night .deng-box1,.night .deng-t{background:0 0!important}@-moz-keyframes swing{0%{-moz-transform:rotate(-10deg)}50%{-moz-transform:rotate(10deg)}100%{-moz-transform:rotate(-10deg)}}@-webkit-keyframes swing{0%{-webkit-transform:rotate(-10deg)}50%{-webkit-transform:rotate(10deg)}100%{-webkit-transform:rotate(-10deg)}} 
  57. html, body, div, span, applet, object, iframe, h1, h2, h3, h4, h5, h6, p, blockquote, pre, a, abbr, acronym, address, big, cite, code, del, dfn, em, img, ins, kbd, q, s, samp, small, strike, strong, sub, sup, tt, var, b, u, i, center, dl, dt, dd, ol, ul, li, fieldset, form, label, legend, table, caption, tbody, tfoot, thead, tr, th, td, article, aside, canvas, details, embed, figure, figcaption, footer, header, hgroup, menu, nav, output, ruby, section, summary, time, mark, audio, video { 
  58.      font-family:'WeezerFont'
  59. .idcicon{font-family:"idcicon" !important;font-size:36px;font-style:normal;-webkit-font-smoothing:antialiased;-webkit-text-stroke-width:0.2px;-moz-osx-font-smoothing:grayscale;} 
  60. @media (min-width: 767px){ 
  61. .headerwap.auto-width,.containerwap,ul.mui-table-view.mui-grid-view.mui-grid-9,.mobileNoneannouncement,.mobileNoneAG,.mobileNoneCP,.mobileNoneCPgn,.footerwap,.mobileNonecooperation,.mobileNoneBGP{ 
  62.     display: none; 
  63. @media (max-width: 767px) { 
  64. .fix-item,.zdsju-main.zdsjumain,.wy__common-width.wy__cloudProtection-partner,.package,.menu-wrap,.slider-main.auto-width,ul#slider-back,.header.auto-width,.footerweb,.personal-center-container,.product-activity,.wy-container.index-bar.wow.fadeInUp.mobileNone.animated,.Characteristic-no, 
  65. /*灯笼*/ 
  66. .dengl{ 
  67.     display: none; 
  68. .swiper-container{max-width:100%;height:auto;border-radius:3px;}.swiper-container img{max-width:100%;}.swiper-container{margin-top:10px;} 
  69. </style> 
为了方便引用到公用JS全站生效,也可以把以上代码直接封装为JS后加到公用JS代码里面
  1. document.write(" <div class="dengl">"); 
  2. document.write("  <div class="deng-box2">"); 
  3. document.write("    <div class="deng">"); 
  4. document.write("      <div class="xian"></div>"); 
  5. document.write("      <div class="deng-a">"); 
  6. document.write("        <div class="deng-b">"); 
  7. document.write("          <div class="deng-t">年</div></div>"); 
  8. document.write("      </div>"); 
  9. document.write("      <div class="shui shui-a">"); 
  10. document.write("        <div class="shui-c"></div>"); 
  11. document.write("        <div class="shui-b"></div>"); 
  12. document.write("      </div>"); 
  13. document.write("    </div>"); 
  14. document.write("  </div>"); 
  15. document.write("  <div class="deng-box3">"); 
  16. document.write("    <div class="deng">"); 
  17. document.write("      <div class="xian"></div>"); 
  18. document.write("      <div class="deng-a">"); 
  19. document.write("        <div class="deng-b">"); 
  20. document.write("          <div class="deng-t">新</div></div>"); 
  21. document.write("      </div>"); 
  22. document.write("      <div class="shui shui-a">"); 
  23. document.write("        <div class="shui-c"></div>"); 
  24. document.write("        <div class="shui-b"></div>"); 
  25. document.write("      </div>"); 
  26. document.write("    </div>"); 
  27. document.write("  </div>"); 
  28. document.write("  <div class="deng-box1">"); 
  29. document.write("    <div class="deng">"); 
  30. document.write("      <div class="xian"></div>"); 
  31. document.write("      <div class="deng-a">"); 
  32. document.write("        <div class="deng-b">"); 
  33. document.write("          <div class="deng-t">乐</div></div>"); 
  34. document.write("      </div>"); 
  35. document.write("      <div class="shui shui-a">"); 
  36. document.write("        <div class="shui-c"></div>"); 
  37. document.write("        <div class="shui-b"></div>"); 
  38. document.write("      </div>"); 
  39. document.write("    </div>"); 
  40. document.write("  </div>"); 
  41. document.write("  <div class="deng-box">"); 
  42. document.write("    <div class="deng">"); 
  43. document.write("      <div class="xian"></div>"); 
  44. document.write("      <div class="deng-a">"); 
  45. document.write("        <div class="deng-b">"); 
  46. document.write("          <div class="deng-t">快</div></div>"); 
  47. document.write("      </div>"); 
  48. document.write("      <div class="shui shui-a">"); 
  49. document.write("        <div class="shui-c"></div>"); 
  50. document.write("        <div class="shui-b"></div>"); 
  51. document.write("      </div>"); 
  52. document.write("    </div>"); 
  53. document.write("  </div>"); 
  54. document.write("</div>"); 
  55. document.write("<style>"); 
  56. document.write("    .deng-box{position:fixed;top:-40px;right:150px;z-index:9999;pointer-events:none;} .deng-box1{position:fixed;top:-30px;right:10px;z-index:9999;pointer-events:none} .deng-box2{position:fixed;top:-40px;left:150px;z-index:9999;pointer-events:none} .deng-box3{position:fixed;top:-30px;left:10px;z-index:9999;pointer-events:none} .deng-box1 .deng,.deng-box3 .deng{position:relative;width:120px;height:90px;margin:50px;background:#d8000f;background:rgba(255, 0, 0);border-radius:50% 50%;-webkit-transform-origin:50% -100px;-webkit-animation:swing 5s infinite ease-in-out;box-shadow:-5px 5px 30px 4px #fc903d}.deng{position:relative;width:120px;height:90px;margin:50px;background:#d8000f;background:rgba(255, 0, 0);border-radius:50% 50%;-webkit-transform-origin:50% -100px;-webkit-animation:swing 3s infinite ease-in-out;box-shadow:-5px 5px 50px 4px #fa6c00}.deng-a{width:100px;height:90px;background:#d8000f;background:rgba(216,0,15,.1);margin:12px 8px 8px 8px;border-radius:50% 50%;border:2px solid #dc8f03}.deng-b{width:45px;height:90px;background:#d8000f;background:rgba(216,0,15,.1);margin:-4px 8px 8px 26px;border-radius:50% 50%;border:2px solid #dc8f03}.xian{position:absolute;top:-20px;left:60px;width:2px;height:20px;background:#dc8f03}.shui-a{position:relative;width:5px;height:20px;margin:-5px 0 0 59px;-webkit-animation:swing 4s infinite ease-in-out;-webkit-transform-origin:50% -45px;background:orange;border-radius:0 0 5px 5px}.shui-b{position:absolute;top:14px;left:-2px;width:10px;height:10px;background:#dc8f03;border-radius:50%}.shui-c{position:absolute;top:18px;left:-2px;width:10px;height:35px;background:orange;border-radius:0 0 0 5px}.deng:before{position:absolute;top:-7px;left:29px;height:12px;width:60px;content:" ";display:block;z-index:999;border-radius:5px 5px 0 0;border:solid 1px #dc8f03;background:orange;background:linear-gradient(to right,#dc8f03,orange,#dc8f03,orange,#dc8f03)}.deng:after{position:absolute;bottom:-7px;left:10px;height:12px;width:60px;content:" ";display:block;margin-left:20px;border-radius:0 0 5px 5px;border:solid 1px #dc8f03;background:orange;background:linear-gradient(to right,#dc8f03,orange,#dc8f03,orange,#dc8f03)}.deng-t{font-family:黑体,Arial,Lucida Grande,Tahoma,sans-serif;font-size:3.2rem;color:#ffeb3be6;font-weight:700;line-height:85px;text-align:center}.night .deng-box,.night .deng-box1,.night .deng-t{background:0 0!important}@-moz-keyframes swing{0%{-moz-transform:rotate(-10deg)}50%{-moz-transform:rotate(10deg)}100%{-moz-transform:rotate(-10deg)}}@-webkit-keyframes swing{0%{-webkit-transform:rotate(-10deg)}50%{-webkit-transform:rotate(10deg)}100%{-webkit-transform:rotate(-10deg)}}"); 
  57. document.write("html, body, div, span, applet, object, iframe, h1, h2, h3, h4, h5, h6, p, blockquote, pre, a, abbr, acronym, address, big, cite, code, del, dfn, em, img, ins, kbd, q, s, samp, small, strike, strong, sub, sup, tt, var, b, u, i, center, dl, dt, dd, ol, ul, li, fieldset, form, label, legend, table, caption, tbody, tfoot, thead, tr, th, td, article, aside, canvas, details, embed, figure, figcaption, footer, header, hgroup, menu, nav, output, ruby, section, summary, time, mark, audio, video {"); 
  58. document.write("     font-family:'WeezerFont';"); 
  59. document.write("}"); 
  60. document.write(".idcicon{font-family:"idcicon" !important;font-size:36px;font-style:normal;-webkit-font-smoothing:antialiased;-webkit-text-stroke-width:0.2px;-moz-osx-font-smoothing:grayscale;}"); 
  61. document.write("@media (min-width: 767px){"); 
  62. document.write(".headerwap.auto-width,.containerwap,ul.mui-table-view.mui-grid-view.mui-grid-9,.mobileNoneannouncement,.mobileNoneAG,.mobileNoneCP,.mobileNoneCPgn,.footerwap,.mobileNonecooperation,.mobileNoneBGP{"); 
  63. document.write("    display: none;"); 
  64. document.write("}"); 
  65. document.write("}"); 
  66. document.write("@media (max-width: 767px) {"); 
  67. document.write(".fix-item,.zdsju-main.zdsjumain,.wy__common-width.wy__cloudProtection-partner,.package,.menu-wrap,.slider-main.auto-width,ul#slider-back,.header.auto-width,.footerweb,.personal-center-container,.product-activity,.wy-container.index-bar.wow.fadeInUp.mobileNone.animated,.Characteristic-no,"); 
  68. document.write("/*灯笼*/"); 
  69. document.write(".dengl{"); 
  70. document.write("    display: none;"); 
  71. document.write("}"); 
  72. document.write(".swiper-container{max-width:100%;height:auto;border-radius:3px;}.swiper-container img{max-width:100%;}.swiper-container{margin-top:10px;}"); 
  73. document.write("}"); 
  74. document.write("</style>"); 

【审核人:站长】

收藏   加好友   生成海报   分享
点赞(0)
打赏
Tags: 代码 CSS 灯笼 过年 2023

发布者资料

热门文章

技术文摘

查看更多技术文摘
首页
栏目
搜索
会员
投稿