Html 引导程序导航在主机上不起作用
我正在使用引导程序Pill导航(引导程序4)。代码如下:Html 引导程序导航在主机上不起作用,html,bootstrap-4,hosting,nav-pills,Html,Bootstrap 4,Hosting,Nav Pills,我正在使用引导程序Pill导航(引导程序4)。代码如下: 家 关于 接触 尝试使用CDN版本的jquery和引导,即替换这些行 <link href="bootstrap-4.5.0-dist/css/bootstrap.min.css" rel="stylesheet" type="text/css" /> <script type="text/javascript" src=&qu
家
关于
接触
尝试使用CDN版本的jquery和引导,即替换这些行
<link href="bootstrap-4.5.0-dist/css/bootstrap.min.css" rel="stylesheet" type="text/css" />
<script type="text/javascript" src="js/jquery-3.5.1.min.js"></script>
<script type="text/javascript" src="bootstrap-4.5.0-dist/js/bootstrap.min.js"></script>
与
要创建锚定链接,必须命名目标。您可以使用纯HTML。 如果没有表示超链接的href属性,则锚定不会被视为链接,但其格式与“正常”文本无法区分 因此:
家
关于
接触
这通常是由于Javascript、bootstrap和jquery文件没有从各自的文件夹中正确引用而导致的,因为您在本地使用它们,请确保它们被正确地定位,或者使用它们的直接CDN链接引用它们
可能的解决方案有:
<!-- Links -->
<ul class="nav nav-pills">
<li><a href="#home">HOME</a></li>
<li><a href="#about">ABOUT</a></li>
<li><a href="#contact">CONTACT</a></li>
</ul>
<!-- Sections -->
<div id="home">
<a name="home"><h1>Home</h1></a>
</div>
<div id="about">
<a name="about"><h1>About</h1></a>
</div>
<div id="contact">
<a name="contact"><h1>Contact</h1></a>
</div>
最简单的解决方案是使用CDN(也可采用手动方式)
您只需插入下面的代码片段,它应该对您有用
家
关于
接触
是否可以验证JavaScript文件是否正确加载?在我看来,引导脚本不是。请提供指向“live”站点的链接
<a href="#home">This is the link</a>
<a name="home">This is the target</a>
<!-- Links -->
<ul class="nav nav-pills">
<li><a href="#home">HOME</a></li>
<li><a href="#about">ABOUT</a></li>
<li><a href="#contact">CONTACT</a></li>
</ul>
<!-- Sections -->
<div id="home">
<a name="home"><h1>Home</h1></a>
</div>
<div id="about">
<a name="about"><h1>About</h1></a>
</div>
<div id="contact">
<a name="contact"><h1>Contact</h1></a>
</div>