Home > front end >  How to make carousel image and caption side by side
How to make carousel image and caption side by side

Time:01-13

Anyone can help me how to make carousel like this? I didn't found any examples or tutorial to make the carousel like this design.

my carousel design

CodePudding user response:

you can use Bootstrap and play with column and row 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 >
  <h2>Carousel Example</h2>
  <div id="myCarousel"  data-ride="carousel">
    <!-- Indicators -->
    <ol >
      <li data-target="#myCarousel" data-slide-to="0" ></li>
      <li data-target="#myCarousel" data-slide-to="1"></li>
      <li data-target="#myCarousel" data-slide-to="2"></li>
    </ol>

    <!-- Wrapper for slides -->
    <div >

      <div >
      <div >
      <div >
       <div >
          <h3>Los Angeles</h3>
          <p>LA is always so much fun!</p>
        </div>
      </div>
       <div >
       <img src="la.jpg" alt="Los Angeles" style="width:100%;">
      </div>
      </div>
       
       
      </div>

      <div >
 
        <div >
      <div >
       <div >
          <h3>Los Angeles</h3>
          <p>LA is always so much fun!</p>
        </div>
      </div>
       <div >
            <img src="chicago.jpg" alt="Chicago" style="width:100%;">
      </div>
      </div>
      </div>
    
      <div >
        
           <div >
      <div >
       <div >
          <h3>Los Angeles</h3>
          <p>LA is always so much fun!</p>
        </div>
      </div>
       <div >
          <img src="ny.jpg" alt="New York" style="width:100%;">
      </div>
      </div>
      </div>
  
    </div>

    <!-- Left and right controls -->
    <a  href="#myCarousel" data-slide="prev">
      <span ></span>
      <span >Previous</span>
    </a>
    <a  href="#myCarousel" data-slide="next">
      <span ></span>
      <span >Next</span>
    </a>
  </div>
</div>

</body>
</html>

CodePudding user response:

If you are talking about the 15px padding on the left then that’s the default padding on that bootstrap grid.

You can remove it with:
.carousel-inner .col-xs-5{padding-left:0}

However you should read the bootstrap documentation as there is probably a class or something you could add to offset this. (I’ve stopped using the actual bootstrap grids a long time ago.) LINK BELOW: https://www.sitepoint.com/community/t/bootstrap-slider-image-and-caption-side-by-side/113599/2

  •  Tags:  
  • Related