Files
tech-blog/app/static/css/style.css
hz4th_coder e689fed71e 初始化技术博客项目
功能特性:
- 前端文章展示 (Markdown渲染、代码高亮)
- 后台管理系统 (文章、分类、标签、作者管理)
- 图片上传 (点击、拖拽、粘贴)
- 网站设置 (Logo、底部宣传图片上传)
- 访问统计 (IP记录、趋势图表)
- 参考来源、附件支持
- 单端口部署 (16012)

技术栈:
- Flask 3.0 + SQLAlchemy
- SQLite数据库
- marked.js + highlight.js (Markdown渲染)
- Chart.js (统计图表)
2026-06-04 23:12:34 +08:00

693 lines
12 KiB
CSS

/* ==================== 基础样式 ==================== */
:root {
--primary-color: #3498db;
--primary-hover: #2980b9;
--secondary-color: #6c757d;
--success-color: #28a745;
--warning-color: #ffc107;
--danger-color: #dc3545;
--text-color: #333;
--text-light: #666;
--border-color: #e0e0e0;
--bg-color: #f5f5f5;
--card-bg: #fff;
--shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}
* {
margin: 0;
padding: 0;
box-sizing: border-box;
}
body {
font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
line-height: 1.6;
color: var(--text-color);
background-color: var(--bg-color);
}
a {
color: var(--primary-color);
text-decoration: none;
}
a:hover {
color: var(--primary-hover);
}
.container {
max-width: 1200px;
margin: 0 auto;
padding: 0 20px;
}
/* ==================== 导航栏 ==================== */
.navbar {
background: var(--card-bg);
box-shadow: var(--shadow);
padding: 15px 0;
position: sticky;
top: 0;
z-index: 100;
}
.navbar .container {
display: flex;
justify-content: space-between;
align-items: center;
flex-wrap: wrap;
gap: 10px;
}
.logo {
font-size: 1.5rem;
font-weight: bold;
color: var(--text-color);
display: flex;
align-items: center;
gap: 10px;
}
.logo img {
height: 35px;
width: auto;
}
.site-subtitle {
font-size: 0.9rem;
color: var(--text-light);
font-weight: normal;
}
.nav-links {
display: flex;
gap: 20px;
}
.nav-links a {
color: var(--text-color);
padding: 5px 10px;
border-radius: 4px;
transition: all 0.3s;
}
.nav-links a:hover,
.nav-links a.active {
background: var(--primary-color);
color: #fff;
}
/* ==================== 主内容 ==================== */
.main-content {
padding: 30px 0;
}
.content-wrapper {
display: grid;
grid-template-columns: 1fr 300px;
gap: 30px;
}
.content-area {
min-width: 0;
}
/* ==================== 文章卡片 ==================== */
.page-header {
margin-bottom: 25px;
}
.page-header h1 {
font-size: 1.8rem;
color: var(--text-color);
}
.article-card {
background: var(--card-bg);
border-radius: 8px;
overflow: hidden;
box-shadow: var(--shadow);
margin-bottom: 20px;
display: flex;
transition: transform 0.3s;
}
.article-card:hover {
transform: translateY(-2px);
}
.article-cover {
width: 200px;
flex-shrink: 0;
}
.article-cover img {
width: 100%;
height: 100%;
object-fit: cover;
}
.article-body {
padding: 20px;
flex: 1;
}
.article-title {
font-size: 1.3rem;
margin-bottom: 10px;
}
.article-title a {
color: var(--text-color);
}
.article-title a:hover {
color: var(--primary-color);
}
.article-meta {
display: flex;
gap: 15px;
margin-bottom: 10px;
color: var(--text-light);
font-size: 0.9rem;
}
.article-meta .category {
color: var(--primary-color);
}
.article-meta .author {
display: flex;
align-items: center;
gap: 5px;
}
.author-avatar {
width: 20px;
height: 20px;
border-radius: 50%;
}
.author-avatar-lg {
width: 60px;
height: 60px;
border-radius: 50%;
}
.article-summary {
background: #f8f9fa;
padding: 15px;
border-radius: 5px;
margin-bottom: 20px;
color: var(--text-light);
}
.author-card {
display: flex;
gap: 20px;
background: #f8f9fa;
padding: 20px;
border-radius: 8px;
margin: 30px 0;
}
.author-info h4 {
margin-bottom: 5px;
}
.author-info p {
color: var(--text-light);
margin-bottom: 10px;
}
.references-section, .attachments-section {
margin: 30px 0;
padding: 20px;
background: #f8f9fa;
border-radius: 8px;
}
.references-section h3, .attachments-section h3 {
margin-bottom: 15px;
font-size: 1.1rem;
}
.references-section ul, .attachments-section ul {
list-style: none;
}
.references-section li, .attachments-section li {
padding: 8px 0;
border-bottom: 1px solid #e0e0e0;
}
.ref-desc, .att-desc {
color: var(--text-light);
font-size: 0.9em;
margin-left: 10px;
}
.filesize {
color: var(--text-light);
font-size: 0.85em;
margin-left: 10px;
}
.article-summary {
color: var(--text-light);
margin-bottom: 15px;
}
.article-tags {
display: flex;
flex-wrap: wrap;
gap: 8px;
}
/* ==================== 文章详情 ==================== */
.article-detail {
background: var(--card-bg);
border-radius: 8px;
padding: 40px;
box-shadow: var(--shadow);
}
.article-header {
margin-bottom: 30px;
}
.article-header .article-title {
font-size: 2rem;
margin-bottom: 15px;
}
.article-header .article-meta {
margin-bottom: 15px;
}
.article-cover {
margin-bottom: 30px;
border-radius: 8px;
overflow: hidden;
}
.article-cover img {
width: 100%;
display: block;
}
.article-content {
font-size: 1.1rem;
line-height: 1.8;
}
.article-content h1, .article-content h2, .article-content h3 {
margin: 1.5em 0 0.8em;
}
.article-content p {
margin-bottom: 1em;
}
.article-content pre {
background: #f4f4f4;
padding: 15px;
border-radius: 5px;
overflow-x: auto;
}
.article-content code {
background: #f4f4f4;
padding: 2px 6px;
border-radius: 3px;
font-family: 'Consolas', monospace;
}
.article-content pre code {
background: none;
padding: 0;
}
.article-footer {
margin-top: 40px;
padding-top: 20px;
border-top: 1px solid var(--border-color);
}
/* ==================== 侧边栏 ==================== */
.sidebar {
display: flex;
flex-direction: column;
gap: 25px;
}
.sidebar-section {
background: var(--card-bg);
border-radius: 8px;
padding: 20px;
box-shadow: var(--shadow);
}
.sidebar-section h3 {
font-size: 1.1rem;
margin-bottom: 15px;
padding-bottom: 10px;
border-bottom: 2px solid var(--primary-color);
}
.search-form {
display: flex;
gap: 5px;
}
.search-form input {
flex: 1;
padding: 8px 12px;
border: 1px solid var(--border-color);
border-radius: 4px;
}
.search-form button {
padding: 8px 12px;
background: var(--primary-color);
color: #fff;
border: none;
border-radius: 4px;
cursor: pointer;
}
.recent-list, .hot-list {
list-style: none;
}
.recent-list li, .hot-list li {
padding: 8px 0;
border-bottom: 1px solid var(--border-color);
}
.recent-list li:last-child, .hot-list li:last-child {
border-bottom: none;
}
.hot-list a {
display: flex;
align-items: center;
gap: 10px;
}
.rank {
display: inline-flex;
align-items: center;
justify-content: center;
width: 20px;
height: 20px;
background: var(--primary-color);
color: #fff;
border-radius: 50%;
font-size: 0.8rem;
}
/* ==================== 标签 ==================== */
.tag {
display: inline-block;
padding: 4px 12px;
background: var(--primary-color);
color: #fff;
border-radius: 15px;
font-size: 0.85rem;
transition: all 0.3s;
}
.tag:hover {
opacity: 0.8;
color: #fff;
}
.tag.active {
background: var(--tag-color, var(--primary-color));
}
.tag-cloud {
display: flex;
flex-wrap: wrap;
gap: 8px;
}
/* ==================== 分页 ==================== */
.pagination {
display: flex;
justify-content: center;
gap: 5px;
margin-top: 30px;
}
.page-link {
display: inline-block;
padding: 8px 15px;
background: var(--card-bg);
border: 1px solid var(--border-color);
border-radius: 4px;
color: var(--text-color);
}
.page-link:hover {
background: var(--primary-color);
color: #fff;
border-color: var(--primary-color);
}
.page-link.active {
background: var(--primary-color);
color: #fff;
border-color: var(--primary-color);
}
.page-link.ellipsis {
border: none;
}
/* ==================== 按钮 ==================== */
.btn {
display: inline-block;
padding: 10px 20px;
border: none;
border-radius: 4px;
cursor: pointer;
font-size: 1rem;
transition: all 0.3s;
text-decoration: none;
}
.btn-primary {
background: var(--primary-color);
color: #fff;
}
.btn-primary:hover {
background: var(--primary-hover);
color: #fff;
}
.btn-secondary {
background: var(--secondary-color);
color: #fff;
}
.btn-secondary:hover {
opacity: 0.9;
color: #fff;
}
.btn-danger {
background: var(--danger-color);
color: #fff;
}
.btn-danger:hover {
opacity: 0.9;
color: #fff;
}
.btn-sm {
padding: 5px 10px;
font-size: 0.85rem;
}
.btn-block {
display: block;
width: 100%;
}
/* ==================== 提示框 ==================== */
.alert {
padding: 15px 20px;
border-radius: 5px;
margin-bottom: 20px;
}
.alert-success { background: #d4edda; color: #155724; }
.alert-danger { background: #f8d7da; color: #721c24; }
.alert-warning { background: #fff3cd; color: #856404; }
.alert-info { background: #d1ecf1; color: #0c5460; }
/* ==================== 空状态 ==================== */
.empty-state {
text-align: center;
padding: 60px 20px;
background: var(--card-bg);
border-radius: 8px;
box-shadow: var(--shadow);
}
.empty-state p {
color: var(--text-light);
margin-bottom: 20px;
}
/* ==================== 错误页面 ==================== */
.error-page {
display: flex;
align-items: center;
justify-content: center;
min-height: 100vh;
text-align: center;
}
.error-page h1 {
font-size: 6rem;
color: var(--primary-color);
}
.error-page p {
font-size: 1.5rem;
margin: 20px 0 30px;
}
/* ==================== 页脚 ==================== */
.footer {
background: var(--card-bg);
padding: 0;
margin-top: 50px;
box-shadow: 0 -2px 8px rgba(0, 0, 0, 0.05);
}
.footer-content {
display: flex;
justify-content: space-between;
align-items: stretch;
height: 150px;
}
.footer-main {
flex: 1;
min-width: 200px;
display: flex;
flex-direction: column;
justify-content: center;
padding: 15px 20px;
}
.footer-main p {
margin: 5px 0;
}
.footer-main .copyright {
color: var(--text-light);
font-size: 0.9rem;
}
.footer-main .technology {
color: var(--text-light);
font-size: 0.85rem;
}
.contact-links {
margin-top: 15px;
display: flex;
gap: 20px;
}
.contact-links a {
color: var(--text-light);
font-size: 0.9rem;
}
.contact-links a:hover {
color: var(--primary-color);
}
.footer-promo {
display: flex;
gap: 5px;
height: 150px;
align-items: stretch;
}
.promo-item {
display: flex;
flex-direction: column;
flex: 1;
min-width: 100px;
height: 150px;
}
.promo-link {
position: relative;
display: block;
height: 150px;
overflow: hidden;
}
.promo-link img {
width: 100%;
height: 150px;
object-fit: cover;
display: block;
transition: transform 0.3s;
}
.promo-link:hover img {
transform: scale(1.02);
}
.promo-title-overlay {
display: none;
}
/* ==================== 响应式 ==================== */
@media (max-width: 992px) {
.content-wrapper {
grid-template-columns: 1fr;
}
.sidebar {
display: grid;
grid-template-columns: repeat(2, 1fr);
}
}
@media (max-width: 768px) {
.navbar .container {
flex-direction: column;
gap: 15px;
}
.article-card {
flex-direction: column;
}
.article-cover {
width: 100%;
height: 200px;
}
.sidebar {
grid-template-columns: 1fr;
}
.article-detail {
padding: 20px;
}
}