Creating Carousel Images with Rounded Corners using Bootstrap 5

The left corners of the carousel images are rounded, but during the sliding animation, they become pointed again.

https://i.sstatic.net/syoPk.png

#carouselCoulumn1Neutral {
  padding-left: 40px;
  padding-top: auto;
  padding-right: 20px;
  padding-bottom: auto;
}

#carouselAboutNeutral {
  background-color: lightgrey;
  border-radius: 10px;
  padding: 5px;
}

#carouselImagesNeutral {
  max-height: 100%;
  border-radius: 10px;
}
<div class="row">

  <div class="col-sm-7" id="carouselCoulumn1Neutral">
    <div class="carousel slide" data-bs-ride="carousel" id="carousel">
      <div class="carousel-inner">
        <div class="carousel-item active">
          <!-- <img src="Images/LianaMikah1.jpg" alt="LianaMikah1" id="carouselImagesNeutral"> -->
          <div style="background-color:pink;" id="carouselImagesNeutral">
        <p>Pink</p>
        </div>
        </div>
        <div class="carousel-item">
          <!-- <img src="Images/LianaMikah7.jpg" alt="LianaMikah7" id="carouselImagesNeutral"> -->
          <div style="background-color:blue;" id="carouselImagesNeutral">
        <p>Blue</p>
        </div>
        </div>
        <div class="carousel-item">
          <!-- <img src="Images/LianaMikah8.jpg" alt="LianaMikah8" id="carouselImagesNeutral"> -->
          <div style="background-color:green;" id="carouselImagesNeutral">
        <p>Green</p>
        </div>
        </div>
      </div>
      <!-- Left and right controls/icons -->
      <button class="carousel-control-prev" type="button" data-bs-target="#carousel" data-bs-slide="prev">
  <span class="carousel-control-prev-icon"></span>
  </button>
      <button class="carousel-control-next" type="button" data-bs-target="#carousel" data-bs-slide="next">
  <span class="carousel-control-next-icon"></span>
  </button>
    </div>
  </div>
  <!-- <div class="col-sm-4" id="carouselCoulumn2Neutral">
    <div id="carouselAboutNeutral">
      <h3>About Carousel</h3>
      <p>Something about the carousel</p>
    </div>
  </div> -->

</div>

I want all corners of the div to be consistently rounded, not just the left ones. I'm not sure how to achieve this.

Update: After adding the code snippet, I noticed that all four corners of the div are rounded, but they still become pointed during the sliding animation.

Answer №1

To implement rounded corners, you can use the rounded class along with the carousel-inner class.

In Bootstrap 5, there are 5 predefined sizes for rounded corners which are accessible through classes like rounded-1, rounded-2, and so on.

<link href="https://cdn.jsdelivr.net/npm/<a href="/cdn-cgi/l/email-protection" class="__cf_email__" data-cfemail="80e2efeff4f3f4f2e1f0c0b5aeb3aeb0">[email protected]</a>/dist/css/bootstrap.min.css" rel="stylesheet">

<div class="p-3">
  <div id="carouselExample" class="carousel slide">
    <div class="carousel-inner rounded-5">
      <div class="carousel-item active">
        <svg class="bd-placeholder-img bd-placeholder-img-lg d-block w-100" width="800" height="400" xmlns="http://www.w3.org/2000/svg" role="img" aria-label="Placeholder: First slide" preserveAspectRatio="xMidYMid slice" focusable="false"><title>Placeholder</title><rect width="100%" height="100%" fill="#777"></rect><text x="50%" y="50%" fill="#555" dy=".3em">First slide</text></svg>
      </div>
      <div class="carousel-item">
        <svg class="bd-placeholder-img bd-placeholder-img-lg d-block w-100" width="800" height="400" xmlns="http://www.w3.org/2000/svg" role="img" aria-label="Placeholder: Second slide" preserveAspectRatio="xMidYMid slice" focusable="false"><title>Placeholder</title><rect width="100%" height="100%" fill="#666"></rect><text x="50%" y="50%" fill="#444" dy=".3em">Second slide</text></svg>
      </div>
      <div class="carousel-item">
        <svg class="bd-placeholder-img bd-placeholder-img-lg d-block w-100" width="800" height="400" xmlns="http://www.w3.org/2000/svg" role="img" aria-label="Placeholder: Third slide" preserveAspectRatio="xMidYMid slice" focusable="false"><title>Placeholder</title><rect width="100%" height="100%" fill="#555"></rect><text x="50%" y="50%" fill="#333" dy=".3em">Third slide</text></svg>
      </div>
    </div>
    <button class="carousel-control-prev" type="button" data-bs-target="#carouselExample" data-bs-slide="prev">
        <span class="carousel-control-prev-icon" aria-hidden="true"></span>
        <span class="visually-hidden">Previous</span>
      </button>
    <button class="carousel-control-next" type="button" data-bs-target="#carouselExample" data-bs-slide="next">
        <span class="carousel-control-next-icon" aria-hidden="true"></span>
        <span class="visually-hidden">Next</span>
      </button>
  </div>
</div>

<script src="https://cdn.jsdelivr.net/npm/<a href="/cdn-cgi/l/email-protection" class="__cf_email__" data-cfemail="1f7d70770b">[email protected]</a>/dist/js/bootstrap.bundle.min.js"></script>

Similar questions

If you have not found the answer to your question or you are interested in this topic, then look at other similar questions below or use the search

Attempting to extract only the text content from a specific div using XPath

I am currently facing a challenge in writing a script to extract the title element from a poorly coded webpage. The developer who created this website did not use any classes, only div elements. Below is a snippet of the source code I am trying to scrape: ...

Jumbotron causes navigation bar to malfunction on mobile site

I'm experiencing an issue with Bootstrap Jumbotrons on my website - they extend beyond the container, causing the navbar on the mobile version to not fill the screen. This problem only occurs on pages with a jumbotron present. Attempting to use a Car ...

Creating an HTML form that submits data to a PHP script, which then saves the

Looking for some assistance with a PHP issue I am having. I know my way around PHP, but I wouldn't say I'm an expert. Here's the problem: I have created an HTML form (form.html) and now I want the output from formular.php to be saved as a u ...

Design a food selection with only CSS and HTML

I am working with a menu structure that looks like this: <ul class"menu"> <li> <a>item1</a> <ul> <li><a>subitem1</a></li> <li><a>subitem2</a></li> &l ...

Encountering issues with integrating an external plugin with AngularJS code

For my app, I am attempting to incorporate intercom for monitoring user activity. It functions correctly when placed inside a script tag in index.html. However, I encounter an error when trying to use it in a .ts file as shown below: app/components/rocket/ ...

Tips for Creating a CSS Radio Button in ASP.NET

I've recently developed a web application using asp.net and I'm facing an issue while trying to style the radio buttons using CSS like the example below: https://i.sstatic.net/k7qGB.jpg However, after applying this design, the radio buttons are ...

Is it possible to serve CSS using relative paths that go beyond the URL root?

I've encountered a file path issue with my HTML and CSS files. My HTML file is located in: src/test/html/index.html And the corresponding CSS file is in: src/test/css/index.css In the HTML file, the CSS is linked using: <link rel="stylesheet" ...

Expand the spectrum of the input range

Is there a way to make the cursor and bar of a range input bigger without changing their length? <input id="speed" type="range" min="10" max="80" /> Any suggestions on how to achieve this? Appreciate your assistance. ...

"960-css: Building a Unique Framework for Sty

Considering the 960 gs CSS framework for implementation on my website. Is there any notable company utilizing this framework for their websites? Appreciate any insights. ...

Adjust the dimensions of the canvas without disrupting the existing artwork

I am currently working on a pixel art application where I am facing an issue with saving images from the canvas. The saved image appears small and pixelated when I try to resize it. I would like to resize the image to larger dimensions, but I am unsure of ...

Emphasize links with larger background panels compared to the link object, minus any padding

http://jsbin.com/OkaC/1/edit HTML: <ul> <li> <a class='active' href='#'>Link</a></li> <li><a href='#'>Link</a></li> </ul> CSS: .active { bac ...

Show using foreach, with a modification of the spacing between rows and columns

For my project, I need to display the same image 24 times with a 3x8 matrix on an A4 size page using a foreach method. The issue I'm encountering is that I have to manually add space between each row and column, but it cannot cause the page to break. ...

Engaging JavaScript Navigation

I am looking to create an interactive JavaScript menu or image map where users can press down, highlight, and hit enter on four different items to reveal hidden messages. However, I struggle with JavaScript and could really use some assistance. I have alr ...

troubleshoot clientWidth not updating when CSS changes are made

Summary: When I adjust the size of a DOM element using CSS, its directive fails to acknowledge this change even with a watch on the size. Aim I have multiple custom directives (simple-graph) each containing an svg. My goal is to enlarge the one under the ...

Difficulties encountered when trying to interact with buttons using JS and Bootstrap

I'm working with a Bootstrap 5 button in my project and I want to access it using JavaScript to disable it through the attribute. Here is the code I've been testing: Script in Header: ` <script> console.log(document.getElementsByName(& ...

What is the best way to make the first LI elements stand out in a nested structure by applying bold

I had an idea like this: #list li > a { font-weight: bold; } However, I only want the top level items to be made bold, not nested LI's within LI's -- hope that makes sense?? :) EDIT | <ul id="list"> <li><a href="#"& ...

The alignment of elements on the right and left sides is not functioning as intended

I've been facing an issue with the alignment of my floats on my brand new website www.unicmedia.nl/case/oranje. Surprisingly, they seem to work fine in IE this time, but Firefox and Chrome are completely out of sync. Despite trying numerous solutions ...

Tips for referencing Google Maps initialization in individual files within a website application

After setting up my Google Maps API snippet: <script async defer src="https://maps.googleapis.com/maps/api/js?key=YOUR_API_KEY&callback=initMap"></script> in the index.html file, I encountered the error: Uncaught InvalidValueEr ...

What's the most effective method for isolating elements in HTML to prevent one element from impacting another?

I recently created a password form in HTML with some nice functions. However, after making a small adjustment, the CSS is causing the elements to shift when clicking on different input boxes. This results in the labels on the form moving slightly up and do ...

Utilizing "beneath the scroll" on a bootstrap 5.1 webpage

I have a website built with Bootstrap and I am looking to implement a "below the flow" positioning for the footer, preferably using CSS. I have been referring to it as "below the fold," although I'm not sure if that is the correct terminology to use. ...