文章目录章节滚动定位导航

代码语言:html

所属分类:菜单导航

下面为部分代码预览,完整代码请点击下载或在bfwstudio webide中打开

<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>导航进度</title>
    <meta name="description" content="导航进度,滚动定位,锚点导航">
    <style>
        * {
            margin: 0;
            padding: 0;
            list-style-type: none;
            box-sizing: border-box;
        }

        body {
            font-size: 16px;
            line-height: 1.6;
            font-family: 'Roboto', sans-serif;
        }

        .toc {
            position: fixed;
            left: 3em;
            top: 5em;
            padding: 1em;
            width: 14em;
            line-height: 2;
        }
        .toc ul {
            list-style: none;
            padding: 0;
            margin: 0;
        }
        .toc ul ul {
            padding-left: 2em;
        }
        .toc li a {
            display: inline-block;
            color: #aaa;
            text-decoration: none;
            -webkit-transition: all 0.3s cubic-bezier(0.23, 1, 0.32, 1);
            transition: all 0.3s cubic-bezier(0.23, 1, 0.32, 1);
        }
        .toc li.visible > a {
            color: #111;
            -webkit-transform: translate(5px);
            -ms-transform: translate(5px);
            transform: translate(5px);
        }

        .toc-marker {
            position: absolute;
            top: 0;
            left: 0;
            width: 100%;
            height: 100%;
            z-index: -1;
        }
        .toc-marker path {
            -webkit-transition: all 0.3s ease;
            transition: all 0.3s ease;
        }

        .contents {
            padding: 1em;
            max-width: 800px;
            font-size: 1.2em;
            font-family: 'Frank Ruhl Libre', sans-serif;
            margin-left: 230px;
        }
        .contents img {
            max-width: 100%;
        }
        .contents .code-block {
            white-space: pre;
            overflow: auto;
            max-width: 100%;
        }
        .contents .code-block code {
            display: block;
            background-color: #f9f9f9;
            padding: 10px;
        }
        .contents .code-inline {
            background-color: #f9f9f9;
            padding: 4px;
        }
        .contents h2
        h3 {
            padding-top: 1em;
        }
        .contents h2 {
            margin-top: 1.2em;
        }

@media screen and (max-width: 1200px) {
            body {
                font-size: 14px;
            }
        }
    </style>
</head>
<body>

    <nav class="toc">
        <ul>
            <li><a href="#intro">第一章</a></li>
            <li>
                <a href="#dev">第二章</a>
                <ul>
                    <li><a href="#dev-edit-html">春</a></li>
                    <li><a href="#dev-element-classes">夏</a></li>
                    <li><a href="#dev-slide-classes">秋</a></li>
                    <li><a href="#dev-export-html">冬</a></li>
                </ul>
            </li>
            <li>
                <a href="#css">第三章</a>
                <ul>
                    <li><a href="#css-fonts">高端</a></li>
                    <li><a href="#css-developer-mode">大气</a></li>
                    <li><a href="#css-examples">上档次</a></li>
                </ul>
            </li>
        </ul>
        <svg class="toc-marker" width="200" height="200">
            <path stroke="#444" stroke-width="3" fill="transparent" stroke-dasharray="0, 0, 0, 1000" stroke-linecap="round" stroke-linejoin="round" transform="translate(-0.5, -0.5)" />
        </svg>
    </nav>

    <article class="contents">
        <section id="intro">
            <h2>第一章</h2>

            <h2>匝</h2>
 .........完整代码请登录后点击上方下载按钮下载查看

网友评论0