Html 如何修复子页面的超链接';s标签?bootsrap4
我正在做我的第一个大项目。我几乎什么都做了,但菜单有问题。单击菜单中的链接可打开子页面,但不会转到标签Html 如何修复子页面的超链接';s标签?bootsrap4,html,css,bootstrap-4,Html,Css,Bootstrap 4,我正在做我的第一个大项目。我几乎什么都做了,但菜单有问题。单击菜单中的链接可打开子页面,但不会转到标签 <li class="nav-item dropdown"> <a class="nav-link dropdown-toggle" data-toggle="dropdown" data-target="dropdown_target" href="#"> <span class="caret"></span> Nurty</a&
<li class="nav-item dropdown">
<a class="nav-link dropdown-toggle" data-toggle="dropdown" data-target="dropdown_target" href="#">
<span class="caret"></span>
Nurty</a>
<div class="dropdown-menu aria-labelledby=dropdown_target">
<a class="dropdown-item" href="/nurty.html">Techouse</a>
<a class="dropdown-item" href="/nurty.html#minit">Minimal</a>
<a class="dropdown-item" href="/nurty.html#classt">Classic</a>
<a class="dropdown-item" href="/nurty.html#detrt">Detroit</a>
<a class="dropdown-item disabled" href="/nurty.html#hardgroove">Hardgroove</a>
<a class="dropdown-item" href="/nurty.html#hart">Hard</a>
</div>
在子页面中,我想转到以下标签:
<section id="minit">
但仍然不起作用
我如何修复它,或者可能是其他方法来解决它?这是您需要的工作示例,我还通过添加css
平滑行为添加了平滑scoll:smooth
,我添加了1500px
高度以清晰地查看您的问题
Index.html
<link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/4.2.1/css/bootstrap.min.css">
<li class="nav-item dropdown">
<a class="nav-link dropdown-toggle" data-toggle="dropdown" data-target="dropdown_target" href="#">
<span class="caret"></span>
Nurty
</a>
<div class="dropdown-menu aria-labelledby=dropdown_target">
<a class="dropdown-item" href="example.html">Techouse</a>
<a class="dropdown-item" href="example.html#minit">Minimal</a>
<a class="dropdown-item" href="example.html#classt">Classic</a>
<a class="dropdown-item" href="example.html#detrt">Detroit</a>
<a class="dropdown-item disabled" href="example.html#hardgroove">Hardgroove</a>
<a class="dropdown-item" href="example.html#hart">Hard</a>
</div>
</li>
<script src="https://code.jquery.com/jquery-3.3.1.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/popper.js/1.14.6/umd/popper.min.js"></script>
<script src="https://stackpath.bootstrapcdn.com/bootstrap/4.2.1/js/bootstrap.min.js"></script>
<style>
html {
scroll-behavior: smooth;
}
</style>
<div style="height: 1500px;"></div> <!-- FOR SCROLL VIEW -->
<section id="minit">scroll or die</section>
example.html
<link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/4.2.1/css/bootstrap.min.css">
<li class="nav-item dropdown">
<a class="nav-link dropdown-toggle" data-toggle="dropdown" data-target="dropdown_target" href="#">
<span class="caret"></span>
Nurty
</a>
<div class="dropdown-menu aria-labelledby=dropdown_target">
<a class="dropdown-item" href="example.html">Techouse</a>
<a class="dropdown-item" href="example.html#minit">Minimal</a>
<a class="dropdown-item" href="example.html#classt">Classic</a>
<a class="dropdown-item" href="example.html#detrt">Detroit</a>
<a class="dropdown-item disabled" href="example.html#hardgroove">Hardgroove</a>
<a class="dropdown-item" href="example.html#hart">Hard</a>
</div>
</li>
<script src="https://code.jquery.com/jquery-3.3.1.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/popper.js/1.14.6/umd/popper.min.js"></script>
<script src="https://stackpath.bootstrapcdn.com/bootstrap/4.2.1/js/bootstrap.min.js"></script>
<style>
html {
scroll-behavior: smooth;
}
</style>
<div style="height: 1500px;"></div> <!-- FOR SCROLL VIEW -->
<section id="minit">scroll or die</section>
html{
滚动行为:平滑;
}
滚还是死
addonly#minit not/nurty.html#minit
ok!同样的问题。打开nurty.html页面,但不转移到#minit标签。在nurty.html上,转到标签没有问题。问题来自其他页面。我不明白,你们在说什么。你能给我你的问题的答案吗?标签在nurty.html里面。我想在index.html中显示它,所以当你点击from index.html时,你需要进入nurty.html并滚动到#minit?你犯了一些错误,兄弟