gpt4 book ai didi

javascript - Bootstrap 4 Carousel 组件问题

转载 作者:行者123 更新时间:2023-11-28 06:03:31 25 4
gpt4 key购买 nike

我正在尝试将 Carousel Bootstrap 4 实现到个人元素中。我对 HTML5、CSS3、Bootstrap 4 和 JS 有基本的了解。我看过一些关于如何使用轮播组件的讨论和教程,但无法在浏览器中获得正确的输出。我使用 chrome 和 firefox,在这两个浏览器中都有同样的问题。我已经检查了 (link) 和 (script) 的路径,我什至不得不将 (img data-src="#") 更改为 (img src="#") 以便图像可以正确加载到浏览器中。图像彼此重叠,不知道如何纠正此问题。我直接从 Bootstrap 网站复制代码。这是我第一次进入社区,也是我的第一个问题。只是对这个组件感到有点沮丧。

提前致谢!

Image example of problem in browser

    <!DOCTYPE html>
<html>

<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
<meta http-equiv="x-ua-compatible" content="ie=edge">

<title>Carousel-testing!</title>
<link rel="stylesheet" href="assets\css\bootstrap.css">
<link rel="stylesheet" href="assets\css\bootstrap-theme.css">
<link rel="stylesheet" href="assets\css\app.css">
<link rel="stylesheet" href="assets\css\animate.css">

<script type="text/javascript" src="assets\js\jquery.js"></script>
<script type="text/javascript" src="assets\js\bootstrap.js"></script>
<script type="text/javascript" src="assets\js\app.js"></script>
</head>

<nav>

</nav>

<section id="carousel">

<div id="carousel-example-generic" class="carousel slide" data-ride="carousel">
<ol class="carousel-indicators">
<li data-target="#carousel-example-generic" data-slide-to="0" class="active"></li>
<li data-target="#carousel-example-generic" data-slide-to="1"></li>
<li data-target="#carousel-example-generic" data-slide-to="2"></li>
</ol>
<div class="carousel-inner" role="listbox">
<div class="carousel-item active">
<img src="assets\images\2736779-casino-roulette-in-water-and-fire-isolated-on-black-background.jpg" alt="First slide">
</div>
<div class="carousel-item">
<img src="assets\images\DealerBust.jpg" alt="Second slide">
</div>
<div class="carousel-item">
<img src="assets\images\FH_Gaming_Main-new.jpg" alt="Third slide">
</div>
</div>
<a class="left carousel-control" href="#carousel-example-generic" role="button" data-slide="prev">
<span class="icon-prev" aria-hidden="true"></span>
<span class="sr-only">Previous</span>
</a>
<a class="right carousel-control" href="#carousel-example-generic" role="button" data-slide="next">
<span class="icon-next" aria-hidden="true"></span>
<span class="sr-only">Next</span>
</a>
</div>
</section>

<body>


</body>

</html>

最佳答案

您需要将 HTML 放在 <body> 中标记以使其正确呈现。

<body>
<nav>

</nav>

<section id="carousel">

<div id="carousel-example-generic" class="carousel slide" data-ride="carousel">
<ol class="carousel-indicators">
<li data-target="#carousel-example-generic" data-slide-to="0" class="active"></li>
<li data-target="#carousel-example-generic" data-slide-to="1"></li>
<li data-target="#carousel-example-generic" data-slide-to="2"></li>
</ol>
<div class="carousel-inner" role="listbox">
<div class="carousel-item active">
<img src="assets\images\2736779-casino-roulette-in-water-and-fire-isolated-on-black-background.jpg" alt="First slide">
</div>
<div class="carousel-item">
<img src="assets\images\DealerBust.jpg" alt="Second slide">
</div>
<div class="carousel-item">
<img src="assets\images\FH_Gaming_Main-new.jpg" alt="Third slide">
</div>
</div>
<a class="left carousel-control" href="#carousel-example-generic" role="button" data-slide="prev">
<span class="icon-prev" aria-hidden="true"></span>
<span class="sr-only">Previous</span>
</a>
<a class="right carousel-control" href="#carousel-example-generic" role="button" data-slide="next">
<span class="icon-next" aria-hidden="true"></span>
<span class="sr-only">Next</span>
</a>
</div>
</section>
</body>

</html>

关于javascript - Bootstrap 4 Carousel 组件问题,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/36608025/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com