js实现html代码中无用css过滤去除工具代码

代码语言:html

所属分类:其他

代码描述:js实现html代码中无用css过滤去除工具代码

代码标签: js html 代码 无用 css 过滤 去除 工具 代码

下面为部分代码预览,完整代码请点击下载或在bfwstudio webide中打开

<!doctype html>
<html lang="zh-CN">
<head>
  <meta charset="utf-8" />
  <title>HTML CSS 优化器 - 一键清理无用样式</title>
  <meta name="viewport" content="width=device-width,initial-scale=1" />
  <style>
    * { box-sizing: border-box; margin: 0; padding: 0; }
    
    :root {
      --bg: #0f172a;
      --surface: #1e293b;
      --border: #334155;
      --text: #e2e8f0;
      --muted: #94a3b8;
      --primary: #3b82f6;
      --success: #10b981;
      --danger: #ef4444;
      --mono: 'Cascadia Code', 'Fira Code', Consolas, Monaco, monospace;
    }
    
    body {
      background: linear-gradient(135deg, #0f172a 0%, #1e293b 100%);
      color: var(--text);
      font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
      min-height: 100vh;
      padding: 20px;
    }
    
    .container {
      max-width: 1600px;
      margin: 0 auto;
    }
    
    header {
      text-align: center;
      margin-bottom: 30px;
      padding-bottom: 20px;
      border-bottom: 2px solid var(--border);
    }
    
    h1 {
      font-size: clamp(24px, 5vw, 32px);
      margin-bottom: 10px;
      background: linear-gradient(135deg, #3b82f6, #8b5cf6);
      -webkit-background-clip: text;
      -webkit-text-fill-color: transparent;
      background-clip: text;
    }
    
    .subtitle {
      color: var(--muted);
      font-size: 14px;
    }
    
    .layout {
      display: grid;
      gap: 20px;
      grid-template-columns: 1fr;
    }
    
    @media (min-width: 1200px) {
      .layout {
        grid-template-columns: 1fr 1fr;
      }
    }
    
    .panel {
      background: var(--surface);
      border: 1px solid var(--border);
      border-radius: 12px;
      overflow: hidden;
      box-shadow: 0 10px 40px rgba(0,0,0,0.3);
    }
    
    .panel-header {
      display: flex;
      align-items: center;
      justify-content: space-between;
      padding: 12px 16px;
      background: rgba(59, 130, 246, 0.1);
      border-bottom: 1px solid var(--border);
    }
    
    .panel-title {
      font-weight: 600;
      font-size: 14px;
      display: flex;
      align-items: center;
      gap: 8px;
    }
    
    .badge {
      display: inline-block;
      padding: 3px 10px;
      border-radius: 12px;
      font-size: 11px;
      font-weight: 600;
      background: var(--success);
      color: #000;
    }
    
    .badge.info {
      background: var(--primary);
      color: #fff;
    }
    
    textarea {
      width: 100%;
      min-height: 400px;
      background: #0a0f1a;
      color: #e2e8f0;
      border: none;
      padding: 16px;
      font-family: var(--mono);
      font-size: 13px;
      line-height: 1.6;
      resize: vertical;
      outline: none;
    }
    
    textarea::placeholder {
      color: #475569;
    }
    
    textarea:focus {
      background: #0d1117;
    }
    
    .toolbar {
      display: flex;
      flex-wrap: wrap;
      gap: 12px;
      padding: 20px 0;
      align-items: center;
    }
    
    button {
      padding: 12px 24px;
      border: none;
      border-radius: 8px;
      font-size: 14px;
      font-weight: 600;
      cursor: pointer;
      transition: all 0.2s;
      display: inline-flex;
      align-items: center;
      gap: 8px;
    }
    
    button:hover {
      transform: translateY(-2px);
      box-shadow: 0 4px 12px rgba(0,0,0,0.3);
    }
    
    button:active {
      transform: translateY(0);
    }
    
    button.primary {
      background: linear-gradient(135deg, #3b82f6, #2563eb);
      color: white;
    }
    
    button.success {
      background: linear-gradient(135deg, #10b981, #059669);
      color: white;
    }
    
    button.secondary {
      background: var(--surface);
      color: var(--text);
      border: 1px solid var(--border);
    }
    
    button:disabled {
      opacity: 0.5;
      cursor: not-allowed;
      transform: none !important;
    }
    
    .stats {
      padding: 12px 16px;
      background: rgba(16, 185, 129, 0.1);
      border: 1px solid rgba(16, 185, 129, 0.........完整代码请登录后点击上方下载按钮下载查看

网友评论0