如何并排制作轮播图片和标题
How to make carousel image and caption side by side
任何人都可以帮助我如何制作这样的轮播?
我没有找到任何示例或教程来制作像这样设计的旋转木马。
my carousel design
您可以使用 Bootstrap 并使用列和行 div ---
.content{
float:left;
width:100%;
padding:4em 1em;
text-align:center;
}
<!DOCTYPE html>
<html lang="en">
<head>
<title>slider</title>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<link href="https://maxcdn.bootstrapcdn.com/bootstrap/3.4.1/css/bootstrap.min.css" rel="stylesheet"/>
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script>
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.4.1/js/bootstrap.min.js"></script>
</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">
<div class="row">
<div class="col-md-6">
<div class="content">
<h3>Los Angeles</h3>
<p>LA is always so much fun!</p>
</div>
</div>
<div class="col-md-6">
<img src="la.jpg" alt="Los Angeles" style="width:100%;">
</div>
</div>
</div>
<div class="item">
<div class="row">
<div class="col-md-6">
<div class="content">
<h3>Los Angeles</h3>
<p>LA is always so much fun!</p>
</div>
</div>
<div class="col-md-6">
<img src="chicago.jpg" alt="Chicago" style="width:100%;">
</div>
</div>
</div>
<div class="item">
<div class="row">
<div class="col-md-6">
<div class="content">
<h3>Los Angeles</h3>
<p>LA is always so much fun!</p>
</div>
</div>
<div class="col-md-6">
<img src="ny.jpg" alt="New York" style="width:100%;">
</div>
</div>
</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>
</body>
</html>
如果您谈论的是左侧的 15px 填充,那么这是 bootstrap 网格上的默认填充。
您可以通过以下方式删除它:
.carousel-inner .col-xs-5{padding-left:0}
但是您应该阅读 bootstrap 文档,因为可能有 class 或您可以添加的内容来抵消它。 (我很久以前就停止使用实际的 bootstrap 网格了。)
LINK 下面:
https://www.sitepoint.com/community/t/bootstrap-slider-image-and-caption-side-by-side/113599/2
任何人都可以帮助我如何制作这样的轮播? 我没有找到任何示例或教程来制作像这样设计的旋转木马。
my carousel design
您可以使用 Bootstrap 并使用列和行 div ---
.content{
float:left;
width:100%;
padding:4em 1em;
text-align:center;
}
<!DOCTYPE html>
<html lang="en">
<head>
<title>slider</title>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<link href="https://maxcdn.bootstrapcdn.com/bootstrap/3.4.1/css/bootstrap.min.css" rel="stylesheet"/>
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script>
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.4.1/js/bootstrap.min.js"></script>
</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">
<div class="row">
<div class="col-md-6">
<div class="content">
<h3>Los Angeles</h3>
<p>LA is always so much fun!</p>
</div>
</div>
<div class="col-md-6">
<img src="la.jpg" alt="Los Angeles" style="width:100%;">
</div>
</div>
</div>
<div class="item">
<div class="row">
<div class="col-md-6">
<div class="content">
<h3>Los Angeles</h3>
<p>LA is always so much fun!</p>
</div>
</div>
<div class="col-md-6">
<img src="chicago.jpg" alt="Chicago" style="width:100%;">
</div>
</div>
</div>
<div class="item">
<div class="row">
<div class="col-md-6">
<div class="content">
<h3>Los Angeles</h3>
<p>LA is always so much fun!</p>
</div>
</div>
<div class="col-md-6">
<img src="ny.jpg" alt="New York" style="width:100%;">
</div>
</div>
</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>
</body>
</html>
如果您谈论的是左侧的 15px 填充,那么这是 bootstrap 网格上的默认填充。
您可以通过以下方式删除它:
.carousel-inner .col-xs-5{padding-left:0}
但是您应该阅读 bootstrap 文档,因为可能有 class 或您可以添加的内容来抵消它。 (我很久以前就停止使用实际的 bootstrap 网格了。) LINK 下面: https://www.sitepoint.com/community/t/bootstrap-slider-image-and-caption-side-by-side/113599/2