1
有没有人遇到下面的问题?我的所有目录的 首先看起来像这样:到另一个页面元素的HTML5链接导航到页面顶部而不是指定元素
/root
index.html
/blog
/category
posts.html
/post
mypostname.html
我用引导4.
我想从我的index.html导航至/blog/category/post/mypostname.html
我的index.html的代码如下所示:
<a href="blog/category/post/mypostname.html#post-body-mg-1">
<button class="btn btn-outline-warning">Czytaj więcej …</button>
</a>
代码目的地页:
<div id="post-body-mg-1">(it has content)</div>
的问题是,它导航到博客页面的顶部,而不是指定的div元素。当我把相似的链接放在posts.html页面中时,点击它可以毫无问题地导航到那个元素。
当我写这样的(注意斜线/ posts.html后),此链接:
<a href="blog/category/post/mypostname.html/#post-body-mg-1">
<button class="btn btn-outline-warning">Czytaj więcej …</button>
</a>
它肯定的作品,并导航到指定的格但!它无法加载样式表,因为它使mypostname.html文件更深入目录。 当我在样式表的链接中添加更多级别的路径(../)以匹配这个加深的目录时,它会加载所有内容,但又会停止导航到指定的元素,这更加有趣!
它可能是bootstrap4的问题吗?我怀疑它因为它不涉及引导机制,是吗?
请反馈我的答案结构,以及如果它不正确,因为我是新的Stackoverflow。
哦,因为我从我的实际项目中复制这个,似乎忘记了将名称更改为通用名称。 不幸的是,它与此无关。 我现在要编辑它,以避免更多的混淆。 – krisSzell