当前位置:首页 > 网站应用

状态码页面单页源码

可做为各种错误页!具体点下面的运行看演示

<!DOCTYPE html>
<html>
<head>
  <meta charset="UTF-8">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>服务器错误 - 504</title>
  <!-- 引入Tailwind CSS -->
  <script src="https://cdn.tailwindcss.com"></script>
  
  <script>
    tailwind.config = {
      theme: {
        extend: {
          colors: {
            tv: {
              dark: '#050505',
              glow: '#e0e0e0',
              static: '#f0f0f0'
            }
          },
          fontFamily: {
            tv: ['"VT323"', 'monospace']
          }
        }
      }
    }
  </script>
  
  <style type="text/tailwindcss">
    @layer utilities {
      .text-shadow-glow {
        text-shadow: 0 0 8px rgba(255, 255, 255, 0.8), 
                     0 0 12px rgba(255, 255, 255, 0.5);
      }
      .tv-scanline {
        background: linear-gradient(to bottom, 
                    transparent 50%, 
                    rgba(255, 255, 255, 0.03) 51%, 
                    transparent 51%);
        background-size: 100% 4px;
      }
      .signal-distort {
        clip-path: polygon(0 0, 100% 0, 100% 98%, 0 100%);
      }
    }
  </style>
  
  <style>
    @import url('https://fonts.googleapis.com/css2?family=VT323&display=swap');
    
    body {
      overflow: hidden;
      background-color: #000;
    }
    
    #snowCanvas {
      position: fixed;
      top: 0;
      left: 0;
      width: 100%;
      height: 100%;
      z-index: 1;
      opacity: 0.8;
    }
    
    .tv-frame {
      position: relative;
      z-index: 2;
      border: 12px solid #222;
      border-radius: 4px;
      box-shadow: 0 0 30px rgba(0, 0, 0, 0.8) inset,
                  0 0 20px rgba(0, 0, 0, 0.6);
    }
    
    .error-code {
      animation: signalFlicker 8s infinite alternate,
                 positionJitter 0.3s infinite;
    }
    
    .error-message {
      animation: messageFade 15s infinite alternate,
                 subtleJitter 2s infinite;
    }
    
    @keyframes signalFlicker {
      0%, 10%, 20%, 80%, 90%, 100% { opacity: 1; }
      5%, 15%, 85%, 95% { opacity: 0.8; }
      25%, 75% { opacity: 0.95; }
      50% { opacity: 0.7; }
    }
    
    @keyframes positionJitter {
      0%, 100% { transform: translate(0, 0); }
      25% { transform: translate(-1px, 1px); }
      50% { transform: translate(1px, -1px); }
      75% { transform: translate(-1px, -1px); }
    }
    
    @keyframes subtleJitter {
      0%, 100% { transform: translate(0, 0); }
      50% { transform: translate(0, 1px); }
    }
    
    @keyframes messageFade {
      0%, 10%, 90%, 100% { opacity: 0.7; }
      50% { opacity: 0.5; }
    }
    
    @keyframes powerOn {
      0% { 
        transform: scale(1.2);
        opacity: 0;
        filter: brightness(3);
      }
      30% { 
        opacity: 1;
        filter: brightness(2);
      }
      100% { 
        transform: scale(1);
        filter: brightness(1);
      }
    }
    
    .power-on {
      animation: powerOn 1.2s ease-out forwards;
    }
  </style>
</head>

<body class="bg-tv-dark min-h-screen flex items-center justify-center p-4">
  <canvas id="snowCanvas"></canvas>
  
  <div class="tv-frame w-full max-w-2xl aspect-video flex flex-col items-center justify-center signal-distort power-on">
    <div class="tv-scanline absolute inset-0 pointer-events-none"></div>
    
    <div class="text-center px-6">
      <div class="error-code text-tv-static text-[clamp(5rem,15vw,10rem)] font-bold font-tv text-shadow-glow mb-4">
        504
      </div>
      <div class="error-message text-tv-glow text-[clamp(1rem,3vw,1.5rem)] font-tv leading-relaxed">
        <p>服务器内部错误</p>
        <p>信号接收不良,请检查连接</p>
        <p class="mt-4 text-sm opacity-60">ERROR: INTERNAL SYSTEM FAILURE</p>
      </div>
    </div>
  </div>

  <script>
    const canvas = document.getElementById('snowCanvas');
    const ctx = canvas.getContext('2d');
    
    function resizeCanvas() {
      canvas.width = window.innerWidth;
      canvas.height = window.innerHeight;
    }
    
    resizeCanvas();
    window.addEventListener('resize', resizeCanvas);
    
    function drawSnow() {
      ctx.fillStyle = 'rgba(0, 0, 0, 0.05)';
      ctx.fillRect(0, 0, canvas.width, canvas.height);
      
      const snowDensity = Math.floor(canvas.width * canvas.height * 0.0015);
      ctx.fillStyle = 'rgba(255, 255, 255, ' + (0.3 + Math.random() * 0.7) + ')';
      
      for (let i = 0; i < snowDensity; i++) {
        const x = Math.random() * canvas.width;
        const y = Math.random() * canvas.height;
        const size = Math.random() * 1.2;
        
        ctx.fillRect(x, y, size, size);
      }
      
      if (Math.random() > 0.7) {
        const lineY = Math.random() * canvas.height;
        const lineOpacity = 0.1 + Math.random() * 0.2;
        ctx.fillStyle = 'rgba(255, 255, 255, ' + lineOpacity + ')';
        ctx.fillRect(0, lineY, canvas.width, 1);
      }
      
      requestAnimationFrame(drawSnow);
    }
    
    function signalInterference() {
      const chance = Math.random();
      const snowLayer = document.getElementById('snowCanvas');
      
      if (chance < 0.01) {
        snowLayer.style.opacity = 1;
        setTimeout(() => {
          snowLayer.style.opacity = 0.8 + Math.random() * 0.2;
        }, 50 + Math.random() * 150);
      } else if (chance < 0.05) {
        snowLayer.style.opacity = 0.9 + Math.random() * 0.1;
        setTimeout(() => {
          snowLayer.style.opacity = 0.8;
        }, 300);
      }
      
      setTimeout(signalInterference, 500 + Math.random() * 2000);
    }
    
    drawSnow();
    signalInterference();
  </script>
</body>
</html>


扫描二维码推送至手机访问。

版权声明:本文由追求完美发布,如需转载请注明出处。

本文链接:https://cjw123.com/blog/?id=149

分享给朋友:

相关文章

网站调整公告

        网站开通了也有三年多了,网站也进行了多次的改版,昨天是我生日嫌着没事在家里把网站再进行了一次改版,当大家再次访问网站时,网站已经换上了全新的衣裳,这次的改版也将意味着我自己也会以一个全新的面貌展现,在我过去的一岁里…

html meta标签屏蔽搜索引擎的用法

html页面中的 meta 标签可以用来识别搜索引擎的蜘蛛类型,可以规定meta标签所在的html页面是否被蜘蛛抓取,下面是这个meta标签的用法,大家可以借鉴一下。搜索引擎的 meta 标签的解析下面是meta标签对搜索引擎的解析<meta name='robot…

霓虹灯

<!DOCTYPE html> <html lang="en"> <head>     <meta charset="UTF-8">…

定时炸弹,网页特效

点击下面的运行看效果:<!DOCTYPE html> <html lang="en"> <head>     <meta charset="UTF-…

翻转数字秒表

<!DOCTYPE html> <html lang="en"> <head>     <meta charset="UTF-8">…

发表评论

访客

看不清,换一张

◎欢迎参与讨论,请在这里发表您的看法和观点。