问题描述
我遇到了一个问题,我的引导程序代码可以在JSfiddle上运行,而不能在本地浏览器上运行。下面是代码。问题出现在导航选项卡HREF !
我正在上一门课程,讲师可以轻松地运行相同的代码,但是我遇到了相同代码的问题,我已经尝试了1000种方法,但仍然无法正常工作,我也尝试过检查脚本和链接,但没有进展。
<!DOCTYPE html>
<html lang="en">
<head>
<title>Ristorante Con Fusion: About Us</title>
<Meta name="viewport" content="width=device-width,initial-scale=1,shrink-to-fit=no">
<link rel="stylesheet" type="text/css" href="node_modules\bootstrap\dist\css\bootstrap.min.css">
<link rel="stylesheet" type="text/css" href="style.css">
</head>
<body>
<nav class="navbar navbar-dark navbar-expand-sm fixed-top">
<div class="container">
<button class="navbar-toggler" type="button" data-toggle="collapse" data-target="#Navbar">
<span class="navbar-toggler-icon"></span>
</button>
<a class="navbar-brand mr-auto" href="#"><img src="img/logo.png" height="30" width="41"></a>
<div class="collapse navbar-collapse" id="Navbar">
<ul class="navbar-nav mr-auto">
<li class="nav-items"><a class="nav-link" href="./index.html">Home</a></li>
<li class="nav-items"><a class="nav-link active" href="#">About</a></li>
<li class="nav-items"><a class="nav-link" href="#">Menu</a></li>
<li class="nav-items"><a class="nav-link" href="#">Contact</a></li>
</ul>
</div>
</div>
</nav>
<header class="jumbotron">
<div class="container">
<div class="row row-header">
<div class="col-12 col-sm-6">
<h1>Ristorante con Fusion</h1>
<p>We take inspiration from the World's best cuisines,and create a unique fusion experience. Our lipsmacking creations will tickle your culinary senses!</p>
</div>
<div class="col-12 col-sm">
<div class="col-12 col-sm align-self-center">
<img src="img/logo.png" class="img-fluid">
</div>
</div>
</div>
</div>
</header>
<div class="container">
<div class="row">
<ol class="col-12 breadcrumb">
<li class="breadcrumb-item"><a href="./index.html">Home</a></li>
<li class="breadcrumb-item active">About Us</li>
</ol>
<div class="col-auto">
<h3>About Us</h3>
<hr>
</div>
</div>
<div class="row">
<div class="col-12 col-sm-6">
<h2>Our History</h2>
<p>Started in 2010,Ristorante con Fusion quickly established itself as a culinary icon par excellence in Hong Kong. With its unique brand of world fusion cuisine that can be found Nowhere else,it enjoys patronage from the A-list clientele in Hong Kong. Featuring four of the best three-star Michelin chefs in the world,you never kNow what will arrive on your plate the next time you visit us.</p>
<p>The restaurant traces its humble beginnings to <em>The Frying Pan</em>,a successful chain started by our CEO,Mr. Peter Pan,that featured for the first time the world's best cuisines in a pan.</p>
</div>
<div class="col-sm">
<div class="card">
<h3 class="card-header bg-primary text-white">Facts At a Glance</h3>
<div class="card-body">
<dl class="row">
<dt class="col-6">Started</dt>
<dd>3 Feb. 2013</dd>
<dt class="col-6">Major Stake Holder</dt>
<dd>HK Fine Foods Inc.</dd>
<dt class="col-6">Last Year's Turnover</dt>
<dd>$1,250,375</dd>
<dt class="col-6">Employees</dt>
<dd>40</dd>
</dl>
</div>
</div>
</div>
<div class="col-12">
<div class="card card-body bg-light">
<blockquote class="blockquote">
<p class="mb-0">You better cut the pizza in four pieces because I'm not hungry enough to eat six. </p>
<footer class="blockquote-footer">Yogi Berra,<cite title="Source Title">The Wit and Wisdom of Yogi Berra,P. Pepe,diversion Books,2014</cite></footer>
</blockquote>
</div>
</div>
</div>
<div>
<div class="col-12">
<h2>Corporate leadership</h2>
<nav>
<div class="nav nav-tabs" role ="tablist">
<a href="#peter" class="nav-item nav-link active" role="tab" data-toggle="tab">Peter Pan,CEO</a>
<a href="#danny" class="nav-item nav-link" role="tab" data-toggle="tab">dammy Witherspoon,CFO</a>
<a href="#agumbe" class="nav-item nav-link" role="tab" data-toggle="tab">Agumbe Tang,CTO</a>
<a href="#alberto" class="nav-item nav-link" role="tab" data-toggle="tab">Alberto Somayya,Exec. Chef</a>
</div>
</nav>
<div class="tab-content">
<div role="tabpanel" class="tab-pane fade show active" id="peter">
<h3>Peter Pan <small>Chief EpicurIoUs Officer</small></h3>
<p class="d-none d-sm-block">Our CEO,Peter,credits his hardworking East Asian immigrant parents who undertook the arduous journey to the shores of America with the intention of giving their children the best future. His mother's wizardy in the kitchen whipping up the tastiest dishes with whatever is available inexpensively at the supermarket,was his first inspiration to create the fusion cuisines for which <em>The Frying Pan</em> became well kNown. He brings his zeal for fusion cuisines to this restaurant,pioneering cross-cultural culinary connections.</p>
</div>
<div role="tabpanel" class="tab-pane fade" id="danny">
<h3>Dhanasekaran Witherspoon <small>Chief Food Officer</small></h3>
<p class="d-none d-sm-block">Our CFO,Danny,as he is affectionately referred to by his colleagues,comes from a long established family Tradition in farming and produce. His experiences growing up on a farm in the Australian outback gave him great appreciation for varieties of food sources. As he puts it in his own words,<em>Everything that runs,wins,and everything that stays,pays!</em></p>
</div>
<div role="tabpanel" class="tab-pane fade" id="agumbe">
<h3>Agumbe Tang <small>Chief Taste Officer</small></h3>
<p class="d-none d-sm-block">Blessed with the most discerning gustatory sense,Agumbe,our CTO,personally ensures that every dish that we serve meets his exacting tastes. Our chefs dread the tongue lashing that ensues if their dish does not meet his exacting standards. He lives by his motto,<em>You click only if you survive my lick.</em></p>
</div>
<div role="tabpanel" class="tab-pane fade" id="alberto">
<h3>Alberto Somayya <small>Executive Chef</small></h3>
<p class="d-none d-sm-block">Award winning three-star Michelin chef with wide International experience having worked closely with whos-who in the culinary world,he specializes in creating mouthwatering Indo-Italian fusion experiences. He says,<em>Put together the cuisines from the two craziest cultures,and you get a winning hit! Amma Mia!</em></p>
</div>
</div>
</div>
<div class="row row-content">
<div class="col-12 col-sm-9">
<h2>Facts & figures</h2>
<div class="table-responsive">
<table class="table table-striped">
<thead class="thead-dark">
<tr>
<th> </th>
<th>2013</th>
<th>2014</th>
<th>2015</th>
</tr>
</thead>
<tbody>
<tr>
<th>Employees</th>
<th>15</th>
<th>30</th>
<th>40</th>
</tr>
<tr>
<th>Guests Served</th>
<th>15,000</th>
<th>45,000</th>
<th>1,00,000</th>
</tr>
<tr>
<th>Special Events</th>
<th>3</th>
<th>20</th>
<th>45</th>
</tr>
<tr>
<th>Annual Turnover</th>
<th>$2,51,325</th>
<th>$1,375</th>
<th>$3,000</th>
</tr>
</tbody>
</table>
</div>
</div>
<div class="col-12 col-sm-3"></div>
</div>
</div>
<footer class="footer">
<div class="container">
<div class="row">
<div class="col-4 offset-1 col-sm-2">
<h5>Links</h5>
<ul class="list-unstyled">
<li><a href="./index.html">Home</a></li>
<li><a href="#">About</a></li>
<li><a href="#">Menu</a></li>
<li><a href="#">Contact</a></li>
</ul>
</div>
<div class="col-7 col-sm-5">
<h5>Our Address</h5>
<address>
121,Clear Water Bay Road<br>
Clear Water Bay,Kowloon<br>
HONG KONG<br>
Tel.: +852 1234 5678<br>
Fax: +852 8765 4321<br>
Email: <a href="mailto:[email protected]">[email protected]</a>
</address>
</div>
<div class="col-12 col-sm-4 align-self-center">
<div class="text-center">
<a href="http://google.com/+">Google+</a>
<a href="http://www.facebook.com/profile.PHP?id=">Facebook</a>
<a href="http://www.linkedin.com/in/">LinkedIn</a>
<a href="http://twitter.com/">Twitter</a>
<a href="http://youtube.com/">YouTube</a>
<a href="mailto:">Mail</a>
</div>
</div>
</div>
<div class="row justify-content-center">
<div class="col-auto">
<p>© copyright 2018 Ristorante Con Fusion</p>
</div>
</div>
</div>
</footer>
<script type="text/javascript" src="node_modules\bootstrap\dist\css\bootstrap.js"></script>
<script src="node_modules\jquery\dist\jquery.slim.min.js"></script>
<script src="node_modules\jquery\dist\popper.min.js"></script>
</body>
</html>
解决方法
尝试使用CDN。
替换:
<link rel="stylesheet" type="text/css" href="node_modules\bootstrap\dist\css\bootstrap.min.css">
具有:
<link rel="stylesheet" type="text/css" href="https://stackpath.bootstrapcdn.com/bootstrap/4.5.2/css/bootstrap.min.css">
如果这不起作用,请在上方删除并添加:
<!-- CSS only --><link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/4.5.2/css/bootstrap.min.css" integrity="sha384-JcKb8q3iqJ61gNV9KGb8thSsNjpSL0n8PARn9HuZOnIxN0hoP+VmmDGMN5t9UJ0Z" crossorigin="anonymous">
<!-- JS,Popper.js,and jQuery -->
<script src="https://code.jquery.com/jquery-3.5.1.slim.min.js" integrity="sha384-DfXdz2htPH0lsSSs5nCTpuj/zy4C+OGpamoFVy38MVBnE+IbbVYUew+OrCXaRkfj" crossorigin="anonymous"></script>
<script src="https://cdn.jsdelivr.net/npm/[email protected]/dist/umd/popper.min.js" integrity="sha384-9/reFTGAW83EW2RDu2S0VKaIzap3H66lZH81PoYlFhbGU+6BZp6G7niu735Sk7lN" crossorigin="anonymous"></script>
<script src="https://stackpath.bootstrapcdn.com/bootstrap/4.5.2/js/bootstrap.min.js" integrity="sha384-B4gt1jrGC7Jh4AgTPSdUtOBvfO8shuf57BaghqFfPlYxofvL8/KUEfYiJOMMV+rV" crossorigin="anonymous"></script>
有时,仅包含css文件即可启动引导程序。但是某些功能可能需要jQuery及其脚本文件。