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>
:root {
--bg: #0f172a;
--panel: #111827;
--muted: #94a3b8;
--text: #e5e7eb;
--accent: #22c55e;
--border: #334155;
--mono: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono",
"Courier New", monospace;
}
html, body {
height: 100%;
margin: 0;
background: #0b1220;
color: var(--text);
font-family: ui-sans-serif, system-ui, -apple-system, Segoe UI, Roboto, "Helvetica Neue", Arial;
}
.wrap {
max-width: 1200px;
margin: 24px auto 40px;
padding: 0 16px;
}
h1 { margin: 6px 0 8px; font-size: 22px; letter-spacing: .3px; }
.sub { color: var(--muted); font-size: 13px; margin-bottom: 14px; }
.card {
background: rgba(17,24,39,.66);
border: 1px solid var(--border);
border-radius: 12px;
box-shadow: 0 10px 30px rgba(0,0,0,.25);
overflow: hidden;
margin-top: 12px;
}
.card header {
padding: 10px 12px;
border-bottom: 1px solid var(--border);
background: linear-gradient(180deg, rgba(255,255,255,.04), rgba(255,255,255,0));
display: flex;
align-items: center;
justify-content: space-between;
}
.card header h3 { margin: 0; font-size: 14px; color: #cbd5e1; }
.card .body { padding: 0; }
textarea {
width: 100%;
min-height: 320px;
box-sizing: border-box;
background: #0b1020;
color: #f3f4f6;
border: none;
outline: none;
resize: vertical;
padding: 12px 14px;
font-size: 13px;
line-height: 1.6;
font-family: var(--mono);
}
textarea[readonly] { opacity: .95; }
.toolbar {
display: flex; flex-wrap: wrap; gap: 8px; align-items: center;
margin: 12px 0 10px;
}
button {
background: #0b1220;
color: var(--text);
border: 1px solid var(--border);
border-radius: 10px;
padding: 10px 14px;
font-size: 14px;
cursor: pointer;
transition: transform .04s ease, border-color .15s ease, background .2s ease, opacity .2s ease;
user-select: none;
}
button:hover { border-color: #3d4451; }
button:active { transform: translateY(1px); }
button.primary {
background: linear-gradient(180deg, #16a34a, #16a34a 40%, #0f9a43);
border-color: #16a34a;
color: #fff;
font-weight: 600;
letter-spacing: .3px.........完整代码请登录后点击上方下载按钮下载查看
















网友评论0