OiO.lk Community platform!

Oio.lk is an excellent forum for developers, providing a wide range of resources, discussions, and support for those in the developer community. Join oio.lk today to connect with like-minded professionals, share insights, and stay updated on the latest trends and technologies in the development field.
  You need to log in or register to access the solved answers to this problem.
  • You have reached the maximum number of guest views allowed
  • Please register below to remove this limitation

Bootstrap 5 Carousel shows enlarged image when pressing next or previous if the carousel is wrapped in float CSS

  • Thread starter Thread starter Raptor
  • Start date Start date
R

Raptor

Guest
I am using Bootstrap v5.3.3 Carousel. My problem encountered is that the Carousel shows enlarged image when pressing next or previous if the carousel is wrapped in float-start class.

The minimal codes are here:

Code:
<div class="container">
  <div class="row">
    <div class="col-12">
      <div class="float-start">
        <div id="carousel_project" class="carousel slide img-fluid me-3 mb-3">
                    <div class="carousel-inner">
                        <div class="carousel-item active">
                            <img src="https://place-hold.it/800x800/F00" class="d-block w-100" alt="" />
                        </div>
                        <div class="carousel-item">
                            <img src="https://place-hold.it/800x800/00F" class="d-block w-100" alt="" />
                        </div>
            <div class="carousel-item">
                            <img src="https://place-hold.it/800x800/0F0" class="d-block w-100" alt="" />
                        </div>
                    </div>
                     <button class="carousel-control-prev" type="button" data-bs-target="#carousel_project" data-bs-slide="prev">
                        <span class="carousel-control-prev-icon" aria-hidden="true"></span>
                     </button>
                     <button class="carousel-control-next" type="button" data-bs-target="#carousel_project" data-bs-slide="next">
                        <span class="carousel-control-next-icon" aria-hidden="true"></span>
                     </button>
                </div>
      </div>
      <div>
        <p>Lorem ipsum dolor sit amet, consectetur adipiscing elit. Nulla interdum blandit nisi a tincidunt. Nunc dapibus nibh quis sapien vehicula venenatis. Orci varius natoque penatibus et magnis dis parturient montes, nascetur ridiculus mus. Donec ullamcorper lectus sit amet mollis pretium. Praesent quam tellus, hendrerit id lobortis vitae, facilisis sed tellus. Etiam magna dui, sodales non enim a, aliquet vulputate libero. Phasellus dictum, lacus vel congue tincidunt, eros velit tincidunt dolor, eget dignissim lacus lacus sed ligula. Praesent quis eros blandit sem egestas tincidunt et at libero.</p>
        <p>Phasellus vel laoreet arcu. Quisque dignissim quam ac odio viverra, ac tristique nisi elementum. Curabitur et porta ante, nec pellentesque ligula. Sed accumsan finibus convallis. Donec eu venenatis diam. Suspendisse ornare odio enim, et laoreet risus lobortis vel. Sed lobortis nisl sem, sed commodo augue elementum sit amet. Cras suscipit nisl sed blandit hendrerit. Sed nec purus vel tellus tincidunt malesuada.</p>
        <p>Quisque non mi et tellus dictum dapibus. Cras sit amet interdum dui. Maecenas vestibulum fringilla feugiat. Morbi feugiat lacus volutpat malesuada euismod. Sed ullamcorper dui ac nulla commodo condimentum. Proin finibus felis a est volutpat ultrices. Donec non libero et eros aliquet facilisis. Morbi pharetra lobortis dolor. In non mauris at arcu eleifend lobortis a in ex. Aenean elementum, neque vitae rutrum condimentum, justo sapien tempus arcu, ut convallis elit ex quis nisl. Cras ullamcorper, orci a volutpat sagittis, eros nulla ornare neque, quis blandit odio lorem nec nibh. Nullam egestas ex et pellentesque egestas. Duis faucibus aliquam fermentum. Nullam ac luctus diam. Quisque sed dui tortor. Maecenas nunc quam, maximus a pellentesque ac, malesuada ac augue.</p>
        <p>Curabitur suscipit urna sed mauris aliquam elementum. Duis at tellus eu sem bibendum lacinia. Suspendisse velit tortor, eleifend a ligula eget, volutpat tincidunt metus. Cras molestie, purus ut laoreet fermentum, nisl lorem rhoncus orci, nec scelerisque eros mi non urna. Ut lacinia, lorem id cursus hendrerit, tortor urna vehicula nulla, et lobortis dolor elit id est. Mauris vulputate eros eget malesuada egestas. Sed congue et sapien et lacinia. Duis vulputate magna id fermentum ornare. Praesent vel orci ultrices, condimentum nisl id, lacinia eros. Aenean cursus malesuada augue, id maximus purus scelerisque in. Morbi maximus tellus vel leo pretium imperdiet. Morbi dignissim eros a erat volutpat, sit amet interdum elit malesuada. Ut augue arcu, ultrices eu congue in, convallis nec lacus. Donec sapien ipsum, ultrices ac dolor quis, rhoncus dictum nunc. Vestibulum finibus nulla nec leo viverra, in rutrum felis maximus.</p>
        <p>Aliquam semper mi sit amet finibus vestibulum. Aenean in nisi non lectus cursus placerat interdum eu mi. Quisque finibus ligula at urna efficitur, vitae ornare metus mollis. Ut non euismod dui, ac mollis urna. Pellentesque at ligula at nunc convallis interdum ac vel velit. Cras ullamcorper elit pulvinar turpis suscipit, vel volutpat quam ultrices. Aliquam aliquam diam urna, id luctus nulla sodales eget. Nunc rutrum turpis at purus fermentum, nec finibus nunc convallis. Donec faucibus erat turpis, eleifend gravida nibh gravida non. Sed venenatis mollis orci id euismod.</p>
      </div>
    </div>
  </div>  
</div>

No additional CSS or JS is attached to affect its results. You can find the JSFiddle here.

How can I fix the sizing problem? Thanks.
<p>I am using Bootstrap v5.3.3 Carousel. My problem encountered is that the Carousel shows enlarged image when pressing next or previous if the carousel is wrapped in <code>float-start</code> class.</p>
<p>The minimal codes are here:</p>
<pre><code><div class="container">
<div class="row">
<div class="col-12">
<div class="float-start">
<div id="carousel_project" class="carousel slide img-fluid me-3 mb-3">
<div class="carousel-inner">
<div class="carousel-item active">
<img src="https://place-hold.it/800x800/F00" class="d-block w-100" alt="" />
</div>
<div class="carousel-item">
<img src="https://place-hold.it/800x800/00F" class="d-block w-100" alt="" />
</div>
<div class="carousel-item">
<img src="https://place-hold.it/800x800/0F0" class="d-block w-100" alt="" />
</div>
</div>
<button class="carousel-control-prev" type="button" data-bs-target="#carousel_project" data-bs-slide="prev">
<span class="carousel-control-prev-icon" aria-hidden="true"></span>
</button>
<button class="carousel-control-next" type="button" data-bs-target="#carousel_project" data-bs-slide="next">
<span class="carousel-control-next-icon" aria-hidden="true"></span>
</button>
</div>
</div>
<div>
<p>Lorem ipsum dolor sit amet, consectetur adipiscing elit. Nulla interdum blandit nisi a tincidunt. Nunc dapibus nibh quis sapien vehicula venenatis. Orci varius natoque penatibus et magnis dis parturient montes, nascetur ridiculus mus. Donec ullamcorper lectus sit amet mollis pretium. Praesent quam tellus, hendrerit id lobortis vitae, facilisis sed tellus. Etiam magna dui, sodales non enim a, aliquet vulputate libero. Phasellus dictum, lacus vel congue tincidunt, eros velit tincidunt dolor, eget dignissim lacus lacus sed ligula. Praesent quis eros blandit sem egestas tincidunt et at libero.</p>
<p>Phasellus vel laoreet arcu. Quisque dignissim quam ac odio viverra, ac tristique nisi elementum. Curabitur et porta ante, nec pellentesque ligula. Sed accumsan finibus convallis. Donec eu venenatis diam. Suspendisse ornare odio enim, et laoreet risus lobortis vel. Sed lobortis nisl sem, sed commodo augue elementum sit amet. Cras suscipit nisl sed blandit hendrerit. Sed nec purus vel tellus tincidunt malesuada.</p>
<p>Quisque non mi et tellus dictum dapibus. Cras sit amet interdum dui. Maecenas vestibulum fringilla feugiat. Morbi feugiat lacus volutpat malesuada euismod. Sed ullamcorper dui ac nulla commodo condimentum. Proin finibus felis a est volutpat ultrices. Donec non libero et eros aliquet facilisis. Morbi pharetra lobortis dolor. In non mauris at arcu eleifend lobortis a in ex. Aenean elementum, neque vitae rutrum condimentum, justo sapien tempus arcu, ut convallis elit ex quis nisl. Cras ullamcorper, orci a volutpat sagittis, eros nulla ornare neque, quis blandit odio lorem nec nibh. Nullam egestas ex et pellentesque egestas. Duis faucibus aliquam fermentum. Nullam ac luctus diam. Quisque sed dui tortor. Maecenas nunc quam, maximus a pellentesque ac, malesuada ac augue.</p>
<p>Curabitur suscipit urna sed mauris aliquam elementum. Duis at tellus eu sem bibendum lacinia. Suspendisse velit tortor, eleifend a ligula eget, volutpat tincidunt metus. Cras molestie, purus ut laoreet fermentum, nisl lorem rhoncus orci, nec scelerisque eros mi non urna. Ut lacinia, lorem id cursus hendrerit, tortor urna vehicula nulla, et lobortis dolor elit id est. Mauris vulputate eros eget malesuada egestas. Sed congue et sapien et lacinia. Duis vulputate magna id fermentum ornare. Praesent vel orci ultrices, condimentum nisl id, lacinia eros. Aenean cursus malesuada augue, id maximus purus scelerisque in. Morbi maximus tellus vel leo pretium imperdiet. Morbi dignissim eros a erat volutpat, sit amet interdum elit malesuada. Ut augue arcu, ultrices eu congue in, convallis nec lacus. Donec sapien ipsum, ultrices ac dolor quis, rhoncus dictum nunc. Vestibulum finibus nulla nec leo viverra, in rutrum felis maximus.</p>
<p>Aliquam semper mi sit amet finibus vestibulum. Aenean in nisi non lectus cursus placerat interdum eu mi. Quisque finibus ligula at urna efficitur, vitae ornare metus mollis. Ut non euismod dui, ac mollis urna. Pellentesque at ligula at nunc convallis interdum ac vel velit. Cras ullamcorper elit pulvinar turpis suscipit, vel volutpat quam ultrices. Aliquam aliquam diam urna, id luctus nulla sodales eget. Nunc rutrum turpis at purus fermentum, nec finibus nunc convallis. Donec faucibus erat turpis, eleifend gravida nibh gravida non. Sed venenatis mollis orci id euismod.</p>
</div>
</div>
</div>
</div>
</code></pre>
<p>No additional CSS or JS is attached to affect its results. You can find the JSFiddle <a href="https://jsfiddle.net/shivanraptor/8tauh0v3/" rel="nofollow noreferrer">here</a>.</p>
<p>How can I fix the sizing problem? Thanks.</p>
Continue reading...
 

Latest posts

M
Replies
0
Views
1
Muhammad Ikhwan Perwira
M
Top