Guide on showcasing an Expansion Panel within a Bootstrap Card using HTML, CSS, and Bootstrap

I am struggling to replicate a card design similar to the one shown in this image. I am using HTML, CSS, and Bootstrap for this project. Specifically, I am facing challenges with creating an expansion panel like the one depicted in the image link provided below. Can anyone offer assistance or guidance on how to implement this expansion panel in my code? https://i.sstatic.net/zMEP1.png

I have tried searching online for resources on creating an expansion panel within a Bootstrap card using HTML and CSS but have not found any useful information so far. Your support in resolving this issue would be greatly appreciated.

Here is a snippet of my HTML Code:

<div class="card">
    <div class="card-body">
        // The rest of your HTML code goes here
    </div>
 </div>

And here is a sample of My CSS Code:

.col-sm-3:not(:last-child) {
    border-right: 1px solid #ccc;
    padding: 12px;
}
// Additional CSS rules continue here

Answer №1

If you're searching for the collapse component in Bootstrap, look no further. It seems like you may have implemented it incorrectly, as the div containing extra details should actually be outside the main div.

According to the Bootstrap collapse documentation, the .collapse.show class shows content.

Therefore, if you want specific content to be hidden/shown when clicking a button, it needs to be located elsewhere. I have made some adjustments to your code:

<a class="btn btn-primary" data-toggle="collapse" href="#collapseExample" role="button" aria-expanded="false" aria-controls="collapseExample">
    Open details
  </a>

You should then place the following div outside of the main one:

<div class="collapse" id="collapseExample">
  <div class="card card-body">
    This is where your hidden details will go.
  </div>
</div>

If you'd like to see a working example, check out this CodePen link.

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

Tips for reducing text in a card design

As a newcomer to codeigniter 4, I recently created an event card with a lengthy description. However, when I attempted to display the event data from the database on the card, it ended up becoming elongated due to the length of the description: https://i. ...

Having trouble getting Bootstrap to work in your spring-boot application?

In the process of setting up bootstrap in my Spring Boot project that utilizes Thymeleaf, I encountered an error with the template (index.html) displaying: Malformed markup: Attribute "class" appears more than once in element I suspect this issue is due ...

Switching the content of a button using jQuery and then reverting it

In my quest for a simple feedback mechanism, I want to create an effect where pressing a button will quickly fade it out, change its class and content, then fade it back in before reverting to its original state. Here is the code snippet that I believed w ...

AngularJS: Understanding the difference between ng-show and using display:none

I recently encountered a scenario where I needed to hide an HTML element by default using CSS. Here's how I did it: HTML: <div class="box"> </div> CSS: .box { display: none; } However, I wanted to be able to show and hide the elem ...

Creating an HTML file with embedded PHP syntax

It seems like what I'm attempting to achieve may be seen as impossible, incredibly challenging, or potentially simple, but I am struggling to articulate my intentions effectively to Google. My goal is the following: For templating purposes, I need t ...

Customize Angular Material's Mat-Dialog background blur/darkening effect

Greetings, dear community members, I am currently utilizing angular along with angular material in my projects. By default, when a material dialog is opened, it slightly darkens the background. However, I am interested in having a blurred background inst ...

Place a button at the center of a table

I am having trouble centering a button that I built inside a table. The CSS doesn't seem to be correct and I can't figure out why. I would appreciate any help with this issue. Additionally, the button needs to be displayed in an email, in case th ...

Show the button only when the text is updated

Is there a way to display a button only when the quantity of items in the cart changes, similar to the eBay shopping cart feature? I was able to implement it but it's not functioning as expected. Here is the link to what I have so far. Does anyone kno ...

Using Ajax with jQuery may encounter issues when running from a local file

I have created a basic HTML file with AJAX functionality. index.html: <html> <head> <meta http-equiv="Content-Type" content="text/html; Charset=UTF-8"> <script type="text/javascript" src="jquery.js"></script> </head> ...

What is the reason behind the presence of the digit zero in this particular setting?

Can anyone provide guidance on how to clear the input field of the number zero? I couldn't find any instructions in the documentation at this time. Thanks for your assistance! public class Bag { [DatabaseGenerated(DatabaseGeneratedOption ...

Ways to soften a section of a canvas component?

What is the simplest way to apply a blur effect to a specific portion of my canvas element? I am utilizing the JavaScript 3D Library known as three.js. This library simplifies the use of WebGL. While they offer examples of blur and depth of field effects, ...

Modify the color of the menu in OpenCart 1.5.6.4 to give it a fresh

In the default theme of OpenCart 1.5.6.4, I am looking to change the background color of the dropdown menu which is currently defined by the background image 'menu.png' to a custom hex value. The CSS code for this section is shown below: #menu & ...

`Generating dynamically styled elements`

I am a newcomer so please forgive me if my question is too basic. I have managed to create a code (with some help from the forum) where clicking on an image reveals another one, and so on as you continue to click. The issue I'm facing is that I can&ap ...

Double tap on the YouTube video

Recently, I added a YouTube video to my project. However, I am encountering an issue where when I double click on the video, it opens in a new tab. What I actually want is for the video to open in full screen when clicked. Appreciate any help! ...

What is the best way to align a group of checkboxes to the left side of the page

I am struggling to display a group of 8 checkboxes in 2 columns with labels on the right side of the checkboxes, and I want them to be left-aligned instead of center-aligned. Despite trying different approaches with the CSS, I can't seem to achieve th ...

How to place the cursor inside a content-editable DIV using Javascript and jQuery

I've been exploring different methods for moving the cursor around, but I'm struggling to find an elegant and effective solution. Essentially, what I want is to be able to call a line of code that performs the following pseudo code: Calculate ...

Learn how to dynamically clear and update source data in jQuery autocomplete for enhanced functionality

Here is a snippet of my jQuery code. In this code, 'year' refers to the form input tag ID, and 'years' is an array variable containing all the year values. I have set this array as the source for autocomplete, which works fine. However, ...

create the text with double bold - adjusted pages

Is there a method to enhance the boldness of the text without adjusting the font size? Currently, the following styling is applied: numbers: { fontSize: 30, color: '#31C283', fontWeight: 'bold', }, Is there a way to m ...

Attempting to implement a button element in a reactstrap card to toggle the visibility of the card's text

Is there a way to implement a toggle feature for the card text ({card.description}) by clicking on the detail button? Do I need to use a state function or is there a simpler method using collapse? I would like the card image and title to always be displaye ...

What is the reason behind the extra space generated when a keyframe content contains a diacritic mark?

My Angular app's home page features dynamic word changes defined in CSS: .header-text:after { display: inline-block; content:''; animation: fide-in 5s linear infinite; } @keyframes fide-in { 0% { content:'BLA'; opacit ...