<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<script src="https://cdn.tailwindcss.com"></script>
<link href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.7.2/css/all.min.css" rel="stylesheet">
<title>Fifteen Pages with Beautiful Sidebar</title>
<style>
body {
transition: background-color 0.3s ease;
margin: 0;
display: flex;
font-family: 'Inter', sans-serif;
}
.dark body {
background-color: #1a202c;
color: #fff;
}
.sidebar {
width: 250px;
background: linear-gradient(180deg, #3f4c6b 0%, #606c88 100%);
color: white;
position: fixed;
top: 0;
left: -250px;
transition: left 0.3s ease;
padding-top: 20px;
z-index: 1000;
box-shadow: 2px 0 5px rgba(0, 0, 0, 0.2);
}
.sidebar.open {
left: 0;
}
.sidebar button:not(.toggle-sidebar-btn) {
display: block;
width: 100%;
padding: 15px 20px;
text-align: left;
background: none;
border: none;
color: white;
cursor: pointer;
transition: all 0.3s ease;
font-size: 16px;
position: relative;
}
.sidebar button:not(.toggle-sidebar-btn)::before {
content: '';
position: absolute;
top: 0;
left: 0;
width: 3px;
height: 100%;
background-color: #007BFF;
opacity: 0;
transition: opacity 0.3s ease;
}
.sidebar button:not(.toggle-sidebar-btn):hover {
background-color: rgba(255, 255, 255, 0.1);
transform: translateX(5px);
}
.sidebar button:not(.toggle-sidebar-btn):hover::before {
opacity: 1;
}
.main-content {
flex-grow: 1;
padding: 20px;
transition: margin-left 0.3s ease;
}
.main-content.shifted {
margin-left: 250px;
}
.toggle-sidebar-btn {
background: linear-gradient(180deg, #3f4c6b 0%, #606c88 100%);
border: none;
color: white;
font-size: 24px;
cursor: pointer;
position: absolute;
top: 50%;
right: -30px;
transform: translateY(-50%);
width: 30px;
border-top-right-radius: 8px;
border-bottom-right-radius: 8px;
box-shadow: 2px 0 5px rgba(0, 0, 0, 0.2);
transition: transform 0.3s ease;
}
.toggle-sidebar-btn.open i {
transform: rotate(180deg);
}
.input-group {
display: flex;
align-items: center;
gap: 8px;
margin-bottom: 12px;
position: relative;
}
.input-label {
min-width: 30px;
text-align: right;
font-weight: 500;
display: flex;
align-items: center;
justify-content: flex-end;
}
input.custom-border {
border-color: #e5e7eb;
transition: border-color 0.3s ease;
}
.dark input.custom-border {
border-color: #4b5563;
}
.color-bordered {
border-color: var(--border-color);
}
.delete-button {
cursor: pointer;
color: red;
margin-left: 4px;
}
.drag-button {
cursor: move;
color: #9ca3af;
margin-right: 4px;
}
.dragging {
opacity: 0.5;
}
.lock-button {
cursor: pointer;
color: #9ca3af;
margin-left: 4px;
}
.locked-input {
opacity: 0.5;
pointer-events: none;
}
.copy-button {
background-color: #6b7280;
color: white;
padding: 4px 8px;
border-radius: 4px;
cursor: pointer;
margin-left: 16px;
transition: background-color 0.3s ease;
}
.copy-button:hover {
background-color: #4b5563;
}
.modal {
display: none;
position: fixed;
z-index: 1;
left: 0;
top: 0;
width: 100%;
height: 100%;
overflow: auto;
background-color: rgba(0, 0, 0, 0.4);
}
.modal-content {
background-color: #fefefe;
margin: 15% auto;
padding: 20px;
border: 1px solid #888;
width: 80%;
max-width: 300px;
border-radius: 4px;
text-align: center;
}
.history-modal {
display: none;
position: fixed;
z-index: 2;
left: 0;
top: 0;
width: 100%;
height: 100%;
overflow: auto;
background-color: rgba(0, 0, 0, 0.4);
}
.history-modal-content {
background-color: #fefefe;
margin: 10% auto;
padding: 20px;
border: 1px solid #888;
width: 80%;
max-width: 600px;
border-radius: 4px;
display: flex;
gap: 20px;
}
.history-list-container {
flex: 1;
}
.history-item {
cursor: pointer;
padding: 8px;
border-bottom: 1px solid #ccc;
}
.history-item:hover {
background-color: #f0f0f0;
}
.export-button {
background-color: #6b7280;
color: white;
padding: 4px 8px;
border-radius: 4px;
cursor: pointer;
margin-left: 16px;
transition: background-color 0.3s ease;
}
.export-button:hover {
background-color: #4b5563;
}
.clear-history-button {
background-color: #dc2626;
color: white;
padding: 4px 8px;
border-radius: 4px;
cursor: pointer;
margin-top: 16px;
transition: background-color 0.3s ease;
align-self: flex-start;
}
.clear-history-button:hover {
background-color: #b91c1c;
}
.copy-history-button {
background-color: #3b82f6;
color: white;
padding: 4px 8px;
border-radius: 4px;
cursor: pointer;
margin-left: 16px;
transition: background-color 0.3s ease;
}
.copy-history-button:hover {
background-color: #2563eb;
}
</style>
<!-- 百度统计 -->
<script>
var _hmt = _hmt || [];
(function () {
var hm = document.createElement("script");
hm.src = "https://hm.baidu.com/hm.js?272119dae6cce7e3ded69c4a57f828d1";
var s = document.getElementsByTagName("script")[0];
s.parentNode.insertBefore(hm, s);
})();
</script>
<!-- Google tag (gtag.js) -->
<script async src="https://www.googletagmanager.com/gtag/js?id=G-N13ZH72VV9"></script>
<script>
window.dataLayer = window.dataLayer || [];
function gtag() { dataLayer.push(arguments); }
gtag('js', new Date());
gtag('config', 'G-N13ZH72VV9');
</script>
</head>
<body class="bg-gray-100 min-h-screen">
<div class="sidebar" id="sidebar">
<button id="page1Btn" class="text-blue-600 hover:text-blue-800 transition-colors duration-300"
onclick="showPage('page1')">页面 1</button>
<button id="page2Btn" class="text-green-600 hover:text-green-800 transition-colors duration-300"
onclick="showPage('page2')">页面 2</button>
<button id="page3Btn" class="text-yellow-600 hover:text-yellow-800 transition-colors duration-300"
onclick="showPage('page3')">页面 3</button>
<button id="page4Btn" class="text-purple-600 hover:text-purple-800 transition-colors duration-300"
onclick="showPage('page4')">页面 4</button>
<button id="page5Btn" class="text-pink-600 hover:text-pink-800 transition-colors duration-300"
onclick="showPage('page5')">页面 5</button>
<button id="page6Btn" class="text-teal-600 hover:text-teal-800 transition-colors duration-300"
onclick="showPage('page6')">页面 6</button>
<button id="page7Btn" class="text-cyan-600 hover:text-cyan-800 transition-colors duration-300"
onclick="showPage('page7')">页面 7</button>
<button id="page8Btn" class="text-lime-600 hover:text-lime-800 transition-colors duration-300"
onclick="showPage('page8')">页面 8</button>
<button id="page9Btn" class="text-orange-600 hover:text-orange-800 transition-colors duration-300"
onclick="showPage('page9')">页面 9</button>
<button id="page10Btn" class="text-amber-600 hover:text-amber-800 transition-colors duration-300"
onclick="showPage('page10')">页面 10</button>
<button id="page11Btn" class="text-rose-600 hover:text-rose-800 transition-colors duration-300"
onclick="showPage('page11')">页面 11</button>
<button id="page12Btn" class="text-fuchsia-600 hover:text-fuchsia-800 transition-colors duration-300"
onclick="showPage('page12')">页面 12</button>
<button id="page13Btn" class="text-violet-600 hover:text-violet-800 transition-colors duration-300"
onclick="showPage('page13')">页面 13</button>
<button id="page14Btn" class="text-indigo-600 hover:text-indigo-800 transition-colors duration-300"
onclick="showPage('page14')">页面 14</button>
<button id="page15Btn" class="text-sky-600 hover:text-sky-800 transition-colors duration-300"
onclick="showPage('page15')">页面 15</button>
<button class="toggle-sidebar-btn" id="toggle-sidebar-btn" onclick="toggleSidebar()">
<i class="fa-solid fa-arrow-right"></i>
</button>
</div>
<div class="main-content" id="main-content">
<div id="page1" class="p-8 bg-white shadow-md rounded-md">
<h1 class="text-3xl font-bold text-blue-600 mb-4">这是页面 1</h1>
<!--
以下是将完整代码添加到页面 1 的详细步骤:
1. 添加 HTML 内容
若你有 HTML 代码,可直接将其粘贴到这个注释下方。
示例:若要添加一个段落,可这样写:
<p>这是新添加的段落内容。</p>
2. 添加 CSS 样式
若你有 CSS 样式,可将其添加到 <style> 标签内(位于 <head> 部分)。
若要为页面 1 单独添加样式,可在该注释下方使用 <style> 标签包裹 CSS 代码。
示例:
<style>
/* 为页面 1 内的段落设置颜色 */
#page1 p {
color: blue;
}
</style>
3. 添加 JavaScript 代码
若你有 JavaScript 代码,可将其添加到 <script> 标签内,该标签可放在 <head> 部分或 <body> 的末尾。
若要为页面 1 单独添加 JavaScript 代码,可在该注释下方使用 <script> 标签包裹代码。
示例:
<script>
// 页面 1 加载完成后弹出提示框
window.onload = function() {
alert('页面 1 已成功加载!');
};
</script>
-->
</div>
<div id="page2" class="p-8 bg-white shadow-md rounded-md hidden">
<h1 class="text-3xl font-bold text-green-600 mb-4">这是页面 2</h1>
<p class="text-gray-700">页面 2 同样精彩,快来一探究竟。</p>
</div>
<div id="page3" class="p-8 bg-white shadow-md rounded-md hidden">
<h1 class="text-3xl font-bold text-yellow-600 mb-4">这是页面 3</h1>
<p class="text-gray-700">页面 3 有不一样的体验等你发现。</p>
</div>
<div id="page4" class="p-8 bg-white shadow-md rounded-md hidden">
<h1 class="text-3xl font-bold text-purple-600 mb-4">这是页面 4</h1>
<p class="text-gray-700">探索页面 4,开启新的旅程。</p>
</div>
<div id="page5" class="p-8 bg-white shadow-md rounded-md hidden">
<h1 class="text-3xl font-bold text-pink-600 mb-4">这是页面 5</h1>
<p class="text-gray-700">页面 5 为你带来别样的精彩。</p>
</div>
<div id="page6" class="p-8 bg-white shadow-md rounded-md hidden">
<h1 class="text-3xl font-bold text-teal-600 mb-4">这是页面 6</h1>
<p class="text-gray-700">页面 6 充满新的魅力。</p>
</div>
<div id="page7" class="p-8 bg-white shadow-md rounded-md hidden">
<h1 class="text-3xl font-bold text-cyan-600 mb-4">这是页面 7</h1>
<p class="text-gray-700">页面 7 等待你的探索。</p>
</div>
<div id="page8" class="p-8 bg-white shadow-md rounded-md hidden">
<h1 class="text-3xl font-bold text-lime-600 mb-4">这是页面 8</h1>
<p class="text-gray-700">页面 8 有独特的风景。</p>
</div>
<div id="page9" class="p-8 bg-white shadow-md rounded-md hidden">
<h1 class="text-3xl font-bold text-orange-600 mb-4">这是页面 9</h1>
<p class="text-gray-700">页面 9 给你不一样的感受。</p>
</div>
<div id="page10" class="p-8 bg-white shadow-md rounded-md hidden">
<h1 class="text-3xl font-bold text-amber-600 mb-4">这是页面 10</h1>
<p class="text-gray-700">页面 10 别具一番风味。</p>
</div>
<div id="page11" class="p-8 bg-white shadow-md rounded-md hidden">
<h1 class="text-3xl font-bold text-rose-600 mb-4">这是页面 11</h1>
<p class="text-gray-700">页面 11 带来浪漫体验。</p>
</div>
<div id="page12" class="p-8 bg-white shadow-md rounded-md hidden">
<h1 class="text-3xl font-bold text-fuchsia-600 mb-4">这是页面 12</h1>
<p class="text-gray-700">页面 12 充满奇幻色彩。</p>
</div>
<div id="page13" class="p-8 bg-white shadow-md rounded-md hidden">
<h1 class="text-3xl font-bold text-violet-600 mb-4">这是页面 13</h1>
<p class="text-gray-700">页面 13 散发神秘气息。</p>
</div>
<div id="page14" class="p-8 bg-white shadow-md rounded-md hidden">
<h1 class="text-3xl font-bold text-indigo-600 mb-4">这是页面 14</h1>
<p class="text-gray-700">页面 14 开启智慧之旅。</p>
</div>
<div id="page15" class="p-8 bg-white shadow-md rounded-md hidden">
<h1 class="text-3xl font-bold text-sky-600 mb-4">这是页面 15</h1>
<p class="text-gray-700">页面 15 让你心旷神怡。</p>
</div>
</div>
<script>
function showPage(pageId) {
const pages = ['page1', 'page2', 'page3', 'page4', 'page5', 'page6', 'page7', 'page8', 'page9', 'page10', 'page11', 'page12', 'page13', 'page14', 'page15'];
pages.forEach(page => {
const element = document.getElementById(page);
if (page === pageId) {
element.classList.remove('hidden');
} else {
element.classList.add('hidden');
}
});
toggleSidebar();
}
function toggleSidebar() {
const sidebar = document.getElementById('sidebar');
const mainContent = document.getElementById('main-content');
const toggleBtn = document.getElementById('toggle-sidebar-btn');
sidebar.classList.toggle('open');
mainContent.classList.toggle('shifted');
toggleBtn.classList.toggle('open');
}
</script>
</body>
</html>
index.html
index.html