gpt4 book ai didi

twitter-bootstrap - Bootstrap Carousel-为什么我的图像没有显示?

转载 作者:行者123 更新时间:2023-12-03 00:36:42 24 4
gpt4 key购买 nike

我必须使用 Bootstrap 创建一个轮播。我对它还很陌生,所以我不知道很多。我不明白为什么不显示图像而只显示文本。在过去的几个小时里,我一直在查找它,但仍然无法理解我做错了什么或遗漏了什么等。我感觉就像把头撞在墙上。任何人都可以提供帮助或提供任何信息,我们将不胜感激。

<!DOCTYPE html>
<html lang="en">

<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>Bootstrap 101 Template</title>
<link href="css/bootstrap.min.css" rel="stylesheet">
</head>

<body>
<div id="Mycarousel" class="carousel">

<ol class="carousel-indicators">
<li class="item0" data-target="#Mycarousel" data-slide-to ="0" class="active"></li>
<li class="item1" data-target="#Mycarousel" data-slide-to ="1"></li>
<li class="item2" data-target="#Mycarousel" data-slide-to ="2"></li>
</ol>

<div class="carousel-inner">
<div class="item active">
<img src="img/cars.jpg" alt="cars" class="img-responsive">
</div>

<div class="item"></div>
<img src="img/waterflower.jpg" alt="waterflower" class="img-responsive">
</div>

<div class="item"></div>
<img src="img/cutehedgehog.jpg" alt="cutehedgehog" class="img-responsive">
</div>

<a class="carousel-control" href="#Mycarousel" data-slide="prev"></a>
<span class="icon-prev"></span>

</div>
</div>

<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.3.7/jquery.min.js"></script>
<script src="js/bootstrap.js"></script>
</body>
</html>

最佳答案

看来你的脚手架没有做好。请参阅额外关闭"</div>"您放置了第二张和第三张幻灯片。

<div class="item"></div>
<img src="img/waterflower.jpg" alt="waterflower" class="img-responsive">
</div>

应该是这样的;

<div class="item">
<img src="img/waterflower.jpg" alt="waterflower" class="img-responsive">
</div>

这是由 W3Schools 提供的工作副本.

<!DOCTYPE html>
<html lang="en">
<head>
<title>Bootstrap Example</title>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css">
</head>
<body>

<div class="container">
<h2>Carousel Example</h2>
<div id="myCarousel" class="carousel slide" data-ride="carousel">
<!-- Indicators -->
<ol class="carousel-indicators">
<li data-target="#myCarousel" data-slide-to="0" class="active"></li>
<li data-target="#myCarousel" data-slide-to="1"></li>
<li data-target="#myCarousel" data-slide-to="2"></li>
</ol>

<!-- Wrapper for slides -->
<div class="carousel-inner">
<div class="item active">
<img src="https://www.w3schools.com/bootstrap/la.jpg" alt="Los Angeles" style="width:100%;">
</div>

<div class="item">
<img src="https://www.w3schools.com/bootstrap/chicago.jpg" alt="Chicago" style="width:100%;">
</div>

<div class="item">
<img src="https://www.w3schools.com/bootstrap/ny.jpg" alt="New york" style="width:100%;">
</div>
</div>

<!-- Left and right controls -->
<a class="left carousel-control" href="#myCarousel" data-slide="prev">
<span class="glyphicon glyphicon-chevron-left"></span>
<span class="sr-only">Previous</span>
</a>
<a class="right carousel-control" href="#myCarousel" data-slide="next">
<span class="glyphicon glyphicon-chevron-right"></span>
<span class="sr-only">Next</span>
</a>
</div>
</div>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.2.1/jquery.min.js"></script>
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/js/bootstrap.min.js"></script>
</body>
</html>

关于twitter-bootstrap - Bootstrap Carousel-为什么我的图像没有显示?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/46900565/

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