html - HTML 中的内部链接
问题描述
我有很多内部链接要用于我正在构建的第一个网站。当我在本地运行它时效果很好,但在实际站点上没有任何内部链接起作用。例如,这是我正在使用的一个内部链接。
<a href ="file:///C:/Users/17249/OneDrive/Dive%20Platform/National%20Popular%20Vote.html">Read More</a>
我明白为什么这不起作用,但如果一个链接还不存在,我可以放什么链接?我想如何为我的网站创建子页面?
提前致谢!
解决方案
您可以在每个页面中放置相对链接。让我们假设您的网站层次结构是这样的:
index.html
category-a.html
category-a/page1.html
category-a/page2.html
category-b.html
category-b/page1.html
category-b/page2.html
The link from index.html to category-a.html would be:
<a href="./category-a.html">category a</a>
The link from category-a.html to category-a/page1.html would be:
<a href="./category-a/page1.html">page 1 of category a</a>
The link from category-a/page1.html to index.html would be:
<a href="../index.html">Home</a>
推荐阅读
- node.js - Mongoose 聚合管道日期大于使用 bson 变量的查询
- reactjs - 在 React 中哪里使用 componentDidUpdate
- dart - 如何为 Dart HTTP 服务器设置测试
- vue.js - 浮动操作按钮隐藏在底部导航栏中
- python - 将实例附加到列表时,属性设置器没有输出
- python - GridSpec 和 ConnectionPatch 问题
- c# - 尝试使用 React.js 和 Redux 将 Azure B2c 身份验证添加到 Asp.net 核心
- git - Git - 切换到其他分支会显示上一个分支的修改
- csv - 由于 Null 数据,没有仪表板报告
- mysql - 编写一个查询,根据监视器的数量(monitorID)为每个用户(userID)创建新列