js+css模拟网络安全教学代码
代码语言:html
所属分类:其他
代码描述:js+css模拟网络安全教学代码
下面为部分代码预览,完整代码请点击下载或在bfwstudio webide中打开
<!DOCTYPE html>
<html lang="zh-CN">
<head>
<meta charset="UTF-8">
<title>网络安全教学平台 - Security Lab</title>
<style>
* { box-sizing: border-box; margin: 0; padding: 0; }
html, body { height: 100%; overflow: hidden; font-family: -apple-system, "Segoe UI", "Microsoft YaHei", "Consolas", monospace; font-size: 13px; color: #d4d4d4; background: #0a0e14; user-select: none; }
#app { display: grid; grid-template-columns: 220px 1fr; height: 100vh; }
/* ========== 侧边栏 ========== */
#sidebar {
background: #0f1419; border-right: 1px solid #1f2937;
display: flex; flex-direction: column; padding: 16px 0;
}
.logo { padding: 0 20px 16px; border-bottom: 1px solid #1f2937; margin-bottom: 12px; }
.logo h1 { color: #4ade80; font-size: 16px; font-weight: 600; }
.logo .sub { color: #6b7280; font-size: 10px; margin-top: 4px; letter-spacing: 1px; }
.nav { flex: 1; }
.nav-item {
padding: 10px 20px; cursor: pointer; display: flex; align-items: center; gap: 10px;
color: #9ca3af; border-left: 3px solid transparent; transition: all .15s;
}
.nav-item:hover { background: #1a2030; color: #e5e7eb; }
.nav-item.active { background: #142030; color: #4ade80; border-left-color: #4ade80; }
.nav-item .icon { font-size: 18px; }
.nav-item .num { color: #4b5563; font-size: 11px; }
.footer { padding: 12px 20px; border-top: 1px solid #1f2937; font-size: 10px; color: #6b7280; line-height: 1.5; }
.footer .warn { color: #f59e0b; }
/* ========== 主区 ========== */
#main { overflow: hidden; display: flex; flex-direction: column; }
.topbar {
height: 48px; background: #0f1419; border-bottom: 1px solid #1f2937;
display: flex; align-items: center; padding: 0 20px; gap: 14px;
}
.topbar h2 { font-size: 15px; color: #fff; font-weight: 500; }
.topbar .desc { color: #6b7280; font-size: 12px; }
.topbar .spacer { flex: 1; }
.topbar .badge {
background: #142030; border: 1px solid #1f4060; color: #4ade80;
padding: 3px 10px; border-radius: 3px; font-size: 11px;
}
.content { flex: 1; overflow: auto; padding: 20px; }
.tab { display: none; }
.tab.active { display: block; }
/* ========== 通用组件 ========== */
.card {
background: #0f1419; border: 1px solid #1f2937; border-radius: 6px;
margin-bottom: 16px; overflow: hidden;
}
.card-header {
padding: 10px 16px; background: #11161e; border-bottom: 1px solid #1f2937;
display: flex; justify-content: space-between; align-items: center;
color: #e5e7eb; font-weight: 500;
}
.card-body { padding: 16px; }
.input, .select, .textarea {
background: #050810; border: 1px solid #1f2937; color: #e5e7eb;
padding: 6px 10px; border-radius: 3px; font-family: inherit; font-size: 12px;
outline: none;
}
.input:focus, .select:focus, .textarea:focus { border-color: #4ade80; }
.btn {
background: #1f4060; border: 1px solid #2a5080; color: #fff;
padding: 6px 14px; border-radius: 3px; cursor: pointer; font-family: inherit; font-size: 12px;
transition: all .15s;
}
.btn:hover { background: #2a5080; }
.btn:disabled { background: #1f2937; color: #6b7280; cursor: not-allowed; }
.btn.primary { background: #16a34a; border-color: #22c55e; }
.btn.primary:hover { background: #22c55e; }
.btn.danger { background: #b91c1c; border-color: #ef4444; }
.btn.danger:hover { background: #ef4444; }
.btn.ghost { background: transparent; }
.row { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.row + .row { margin-top: 8px; }
.label { color: #9ca3af; font-size: 12px; min-width: 80px; }
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.grid-3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 16px; }
/* 终端样式 */
.terminal {
background: #050810; border: 1px solid #1f2937; border-radius: 3px;
font-family: "Consolas", monospace; font-size: 12px; line-height: 1.5;
padding: 12px; height: 320px; overflow-y: auto;
}
.terminal .line { white-space: pre-wrap; word-break: break-all; }
.terminal .line .ts { color: #4b5563; }
.terminal .line .ok { color: #4ade80; }
.terminal .line .err { color: #ef4444; }
.terminal .line .warn { color: #f59e0b; }
.terminal .line .dim { color: #6b7280; }
.terminal .line .info { color: #60a5fa; }
.terminal .line .key { color: #c084fc; }
/* 进度条 */
.progress {
height: 6px; background: #1f2937; border-radius: 3px; overflow: hidden;
margin: 8px 0;
}
.progress-bar {
height: 100%; background: linear-gradient(90deg, #16a34a, #4ade80);
transition: width .1s;
}
/* 标签 */
.tag {
display: inline-block; padding: 2px 8px; border-radius: 3px; font-size: 11px;
background: #1f2937; color: #9ca3af; margin-right: 4px;
}
.tag.ok { background: #142030; color: #4ade80; }
.tag.err { background: #2a1010; color: #ef4444; }
.tag.warn { background: #2a1f10; color: #f59e0b; }
/* 表格 */
table { width: 100%; border-collapse: collapse; font-size: 12px; }
th, td { padding: 8px 10px; text-align: left; border-bottom: 1px solid #1f2937; }
th { color: #9ca3af; font-weight: normal; background: #0a0e14; }
tr:hover td { background: #11161e; }
td.mono, .mono { font-family: "Consolas", monospace; }
/* 状态点 */
.dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; margin-right: 6px; }
.dot.ok { background: #4ade80; box-shadow: 0 0 6px #4ade80; }
.dot.err { background: #ef4444; box-shadow: 0 0 6px #ef4444; }
.dot.warn { background: #f59e0b; box-shadow: 0 0 6px #f59e0b; }
.dot.idle { background: #6b7280; }
/* SQL 注入 */
.payload {
background: #050810; border: 1px solid #1f2937; padding: 6px 10px;
.........完整代码请登录后点击上方下载按钮下载查看















网友评论0