Coding Life

探索编程的无限可能

使用自定义代码装饰博客园

使用自定义代码装饰博客园

简单的css和html代码

css

/* 自定义动画 */
@keyframes fadeIn {
    from { opacity: 0; transform: translateY(20px); }
    to { opacity: 1; transform: translateY(0); }
}

/* 页面整体样式 */
#home {
    max-width: 1200px;
    margin: 0 auto;
    background-color: #ffffff;
    box-shadow: 0 0 20px rgba(0,0,0,0.1);
    animation: fadeIn 1s ease;
}

/* 导航栏美化 */
#navigator {
    background: linear-gradient(135deg, #6e8efb, #a777e3);
    padding: 15px 0;
    position: sticky;
    top: 0;
    z-index: 1000;
}

#navList a {
    color: white;
    padding: 8px 15px;
    border-radius: 20px;
    transition: all 0.3s ease;
}

#navList a:hover {
    background: rgba(255,255,255,0.2);
    transform: translateY(-2px);
}

/* 文章列表样式 */
.day {
    padding: 25px;
    margin: 30px 0;
    border-radius: 10px;
    box-shadow: 0 5px 15px rgba(0,0,0,0.05);
    transition: transform 0.3s ease;
}

.day:hover {
    transform: translateY(-5px);
}

/* 文章标题样式 */
.postTitle {
    font-size: 2em;
    color: #333;
    margin-bottom: 20px;
    position: relative;
    padding-bottom: 10px;
}

.postTitle::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    width: 50px;
    height: 3px;
    background: linear-gradient(90deg, #6e8efb, #a777e3);
    transition: width 0.3s ease;
}

.postTitle:hover::after {
    width: 100px;
}

/* 代码块样式 */
.cnblogs_code {
    background-color: #282c34;
    color: #abb2bf;
    border-radius: 8px;
    padding: 20px;
    margin: 15px 0;
    font-family: 'Fira Code', monospace;
    position: relative;
}

.cnblogs_code:before {
    content: '';
    position: absolute;
    top: 15px;
    left: 15px;
    display: inline-block;
    width: 12px;
    height: 12px;
    border-radius: 50%;
    background: #ff5f56;
    box-shadow: 20px 0 0 #ffbd2e, 40px 0 0 #27c93f;
}

/* 图片样式 */
.blogpost-body img {
    max-width: 100%;
    border-radius: 8px;
    transition: transform 0.3s ease;
}

.blogpost-body img:hover {
    transform: scale(1.02);
}

/* 引用块样式 */
blockquote {
    border-left: 4px solid #6e8efb;
    padding: 15px;
    margin: 20px 0;
    background: #f8f9fa;
    border-radius: 0 8px 8px 0;
}

/* 目录样式 */
#catalog {
    background: #f8f9fa;
    padding: 20px;
    border-radius: 8px;
    position: sticky;
    top: 80px;
}

#catalog a {
    color: #666;
    text-decoration: none;
    transition: color 0.3s ease;
}

#catalog a:hover {
    color: #6e8efb;
}

/* 页脚样式 */
#footer {
    background: linear-gradient(135deg, #6e8efb, #a777e3);
    color: white;
    padding: 30px 0;
    text-align: center;
    margin-top: 50px;
}

/* 响应式设计 */
@media screen and (max-width: 768px) {
    .day {
        margin: 15px;
        padding: 15px;
    }
    
    .postTitle {
        font-size: 1.5em;
    }
}

header.html

<div class="custom-header">
    <!-- 个性化头部背景 -->
    <div class="header-banner">
        <div class="header-overlay"></div>
        <h1 class="blog-title">Coding Life</h1>
        <p class="blog-subtitle">探索编程的无限可能</p>
    </div>

    <!-- 导航菜单 -->
    <nav class="custom-nav">
        <div class="nav-container">
            <div class="nav-brand">
                <a href="/">
                    <img src="你的logo地址" alt="logo" class="nav-logo">
                </a>
            </div>
            <div class="nav-links">
                <a href="/" class="nav-item">首页</a>
                <a href="/categories" class="nav-item">分类</a>
                <a href="/archives" class="nav-item">归档</a>
                <a href="/about" class="nav-item">关于</a>
            </div>
            <div class="nav-search">
                <input type="text" placeholder="搜索文章...">
                <button type="submit">
                    <i class="fas fa-search"></i>
                </button>
            </div>
        </div>
    </nav>
</div>

<style>
.custom-header {
    width: 100%;
    position: relative;
}

.header-banner {
    height: 400px;
    background-image: url('你的背景图片地址');
    background-size: cover;
    background-position: center;
    position: relative;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    color: white;
    text-align: center;
}

.header-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(135deg, rgba(110,142,251,0.8), rgba(167,119,227,0.8));
}

.blog-title {
    font-size: 3em;
    margin-bottom: 10px;
    position: relative;
    z-index: 1;
}

.blog-subtitle {
    font-size: 1.2em;
    position: relative;
    z-index: 1;
}

.custom-nav {
    background: white;
    padding: 15px 0;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
}

.nav-container {
    max-width: 1200px;
    margin: 0 auto;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.nav-logo {
    height: 40px;
}

.nav-links {
    display: flex;
    gap: 20px;
}

.nav-item {
    color: #333;
    text-decoration: none;
    padding: 5px 15px;
    border-radius: 20px;
    transition: all 0.3s ease;
}

.nav-item:hover {
    background: linear-gradient(135deg, #6e8efb, #a777e3);
    color: white;
}

.nav-search {
    display: flex;
    align-items: center;
}

.nav-search input {
    padding: 8px 15px;
    border: 1px solid #ddd;
    border-radius: 20px;
    margin-right: 10px;
}

.nav-search button {
    background: linear-gradient(135deg, #6e8efb, #a777e3);
    color: white;
    border: none;
    padding: 8px 15px;
    border-radius: 20px;
    cursor: pointer;
    transition: transform 0.3s ease;
}

.nav-search button:hover {
    transform: translateY(-2px);
}
</style>

footer.html

<footer class="custom-footer">
    <div class="footer-content">
        <div class="footer-section">
            <h3>关于博主</h3>
            <p>热爱编程、热爱生活</p>
            <p>致力于分享技术经验与学习心得</p>
        </div>
        
        <div class="footer-section">
            <h3>联系方式</h3>
            <div class="social-links">
                <a href="#" class="social-item">
                    <i class="fab fa-github"></i>
                </a>
                <a href="#" class="social-item">
                    <i class="fab fa-weixin"></i>
                </a>
                <a href="#" class="social-item">
                    <i class="fas fa-envelope"></i>
                </a>
            </div>
        </div>
        
        <div class="footer-section">
            <h3>网站统计</h3>
            <p>文章数量:xxx篇</p>
            <p>访问次数:xxx次</p>
            <p>运行天数:xxx天</p>
        </div>
    </div>
    
    <div class="footer-bottom">
        <p>© 2024 Your Blog Name. All rights reserved.</p>
        <p>Powered by 博客园</p>
    </div>
</footer>

<style>
.custom-footer {
    background: linear-gradient(135deg, #6e8efb, #a777e3);
    color: white;
    padding: 50px 0 20px;
    margin-top: 50px;
}

.footer-content {
    max-width: 1200px;
    margin: 0 auto;
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 30px;
    padding: 0 20px;
}

.footer-section {
    text-align: center;
}

.footer-section h3 {
    margin-bottom: 20px;
    position: relative;
    display: inline-block;
}

.footer-section h3::after {
    content: '';
    position: absolute;
    bottom: -5px;
    left: 0;
    width: 100%;
    height: 2px;
    background: rgba(255,255,255,0.3);
}

.social-links {
    display: flex;
    justify-content: center;
    gap: 20px;
    margin-top: 20px;
}

.social-item {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: rgba(255,255,255,0.1);
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    text-decoration: none;
    transition: all 0.3s ease;
}

.social-item:hover {
    background: rgba(255,255,255,0.2);
    transform: translateY(-5px);
}

.footer-bottom {
    text-align: center;
    margin-top: 30px;
    padding-top: 20px;
    border-top: 1px solid rgba(255,255,255,0.1);
}

@media screen and (max-width: 768px) {
    .footer-content {
        grid-template-columns: 1fr;
    }
    
    .footer-section {
        padding: 20px 0;
    }
}
</style>

posted @   MrLyu9277  阅读(2)  评论(0编辑  收藏  举报
相关博文:
阅读排行:
· 周边上新:园子的第一款马克杯温暖上架
· 分享 3 个 .NET 开源的文件压缩处理库,助力快速实现文件压缩解压功能!
· Ollama——大语言模型本地部署的极速利器
· DeepSeek如何颠覆传统软件测试?测试工程师会被淘汰吗?
· 使用C#创建一个MCP客户端
点击右上角即可分享
微信分享提示