我的博客

江山代有才人出,各领风骚数百年

我的博客自定义主题HTML代码

1. 博客侧边栏公告HTML代码

<div style="text-align: center;">
    <p style="font-family: 楷体; font-size: 16px;">生活匆匆忙忙,总有些宝贵的知识和美好的感悟想要记录下来~</p>
    <img src="https://img2024.cnblogs.com/blog/3015150/202405/3015150-20240511105647552-2109754589.png" style="width: 100%; height: 100%;">
</div>

2. 博客首页HTML代码

<!DOCTYPE html>
<html lang="zh-CN">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>我的博客</title>
    <style>
        body, html {
            margin: 0;
            padding: 0;
            height: 100%;
        }
        .container {
            position: relative;
            width: 100%;
            height: 100vh;
            background-image: url('https://img2024.cnblogs.com/blog/3015150/202405/3015150-20240513104959464-1645056383.jpg');
            background-size: cover;
            background-position: center;
            display: flex;
            flex-direction: column;
            justify-content: center;
            align-items: center;
            color: white;
            font-family: '楷体', cursive;
        }
        .button {
            margin-top: 20px;
            padding: 10px 20px;
            background-color: rgba(255, 255, 255, 0.5);
            border: none;
            border-radius: 5px;
            font-size: 18px;
            font-family: '楷体', cursive; /* 使用楷体 */
            cursor: pointer;
        }
        .button:hover {
            background-color: rgba(255, 255, 255, 0.8);
        }
    </style>
</head>
<body>
    <div class="container">
        <h1 style="font-size: 26px;">江山代有才人出,各领风骚数百年</h1>
        <button class="button" onclick="smoothScroll()">我爱学习</button>
    </div>

    <script>
        function smoothScroll() {
            const imageBottom = document.querySelector('.container').getBoundingClientRect().bottom;
            window.scroll({
                top: imageBottom,
                behavior: 'smooth'
            });
        }
    </script>
</body>
</html>

 

posted @ 2024-05-13 15:05  执梦不忘初心  阅读(66)  评论(0)    收藏  举报