一个简单的自适应html5导航模板

一个简单的 HTML 导航模板示例,它包含基本的导航栏结构,同时使用了 CSS 进行样式美化,让导航栏看起来更美观。另外,还添加了一些 JavaScript 代码,用于在移动端实现导航菜单的展开和收起功能。

PHP

复制代码
<!DOCTYPE html>
<html>

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>网址导航模板</title>
    <style>
        body {
            font-family: Arial, sans-serif;
            margin: 0;
            padding: 0;
            background-color: #f4f4f4;
        }

        header {
            background-color: #333;
            color: white;
            text-align: center;
            padding: 20px;
            display: flex;
            align-items: center;
            justify-content: space-between;
        }

        .logo {
            width: 50px;
            height: 50px;
            background-color: #fff;
            border-radius: 50%;
            /* 这里可根据实际情况替换为图片 */
            /* background-image: url('your-logo.png');
            background-size: cover; */
        }

        .search-container {
            display: flex;
            background-color: white;
            border-radius: 4px;
            overflow: hidden;
        }

        .search-container input[type="text"] {
            padding: 10px;
            border: none;
            outline: none;
        }

        .search-container button {
            padding: 10px 15px;
            background-color: #007BFF;
            color: white;
            border: none;
            cursor: pointer;
        }

        main {
            display: flex;
            flex-wrap: wrap;
            justify-content: center;
            padding: 20px;
        }

        .category {
            background-color: white;
            border-radius: 8px;
            box-shadow: 0 0 10px rgba(0, 0, 0, 0.1);
            margin: 10px;
            padding: 20px;
            width: 300px;
        }

        .category h2 {
            margin-top: 0;
        }

        .category ul {
            list-style-type: none;
            padding: 0;
        }

        .category li {
            margin-bottom: 10px;
        }

        .category a {
            color: #007BFF;
            text-decoration: none;
            transition: color 0.3s;
        }

        .category a:hover {
            color: #0056b3;
        }

        footer {
            background-color: #333;
            color: white;
            text-align: center;
            padding: 10px;
        }
    </style>
</head>

<body>
    <header>
        <div></div>
        <h1>实用网址导航</h1>
        <div>
            <input type="text" placeholder="输入关键词搜索">
            <button onclick="search()">搜索</button>
        </div>
    </header>
    <main>
        <!-- 学习类网址 -->
        <div>
            <h2>学习资源</h2>
            <ul>
                <li><a href="https://www.zhihu.com/" target="_blank">知乎</a></li>
                <li><a href="https://www.bilibili.com/" target="_blank">哔哩哔哩</a></li>
                <li><a href="https://www.coursera.org/" target="_blank">Coursera</a></li>
            </ul>
        </div>
        <!-- 娱乐类网址 -->
        <div>
            <h2>娱乐天地</h2>
            <ul>
                <li><a href="https://music.163.com/" target="_blank">网易云音乐</a></li>
                <li><a href="https://www.youku.com/" target="_blank">优酷</a></li>
                <li><a href="https://www.douyin.com/" target="_blank">抖音</a></li>
            </ul>
        </div>
        <!-- 工具类网址 -->
        <div>
            <h2>实用工具</h2>
            <ul>
                <li><a href="https://www.66zhan.com/" target="_blank">在线工具</a></li>
                <li><a href="https://www.wqqw.net/" target="_blank">在线工具箱</a></li>
                <li><a href="https://www.zhanf.com" target="_blank">站飞字典网</a></li>
                <li><a href="https://tool.66zhan.com" target="_blank">便民工具网</a></li>
            </ul>
        </div>
    </main>
    <footer>
        <p>版权所有 &copy; 2025 Your Name。保留所有权利。</p>
        <p>备案号:粤ICP备12345678号</p>
    </footer>
    <script>
        function search() {
            var keyword = document.querySelector('.search-container input[type="text"]').value;
            if (keyword) {
                // 这里可以修改为你想要的聚合搜索链接,例如百度搜索
                window.open('https://www.baidu.com/s?wd=' + encodeURIComponent(keyword), '_blank');
            }
        }
    </script>
</body>

</html>

============================

这是一个自适应的简单导航模板,可以根据自己需要进行修改。

相关推荐
KaMeidebaby9 分钟前
卡梅德生物技术快报|蛋白 N 端测序在重组贻贝融合蛋白表征中的应用,解决原核表达序列偏移工艺难题
前端·人工智能·物联网·算法·百度
kyriewen1 小时前
我筛了 1400 个 Claude Code Skills,留下 5 个天天在用的
前端·ai编程·claude
JNX_SEMI2 小时前
AT2401C 2.4GHz 全集成射频前端单芯片技术解析
前端·单片机·嵌入式硬件·物联网·硬件工程
anOnion2 小时前
Agentic 前端开发之 实时显示 AI Agent 终端输出
前端·javascript·人工智能
随风一样自由2 小时前
【前端领域】2026最新前端领域全梳理(框架/工具/AI/跨端/底层标准/就业趋势)
前端·人工智能·前端框架
这是个栗子2 小时前
【前端性能优化】优化数据加载:用 Promise.all 从串行到并行
前端·javascript·性能优化·异步编程·前端优化·promise.all
fei_sun3 小时前
黑洞路由(Null Route/空接口路由)
服务器·前端·javascript
大爱一家盟3 小时前
告别卡点BGM同质化 2026原创卡点音乐素材下载网站 TOP5 推荐
大数据·前端·人工智能
彦为君3 小时前
算法思维与经典智力题
java·前端·redis·算法
aa小小4 小时前
localhost 访问异常排查笔记
前端