How can I create a responsive 3-column layout within a Bootstrap card design?

I am working on an angular 9 application that includes a bootstrap card in the body of the card

<div class="animated fadeIn" 
    style="margin-left: 2%;margin-right: 2%;margin-top: 2%;width: 80%;" 
    id="qgroup-div-g{{ei}}" 
    *ngFor="let g of this.stat?.MyQuestionGroup;let ei=index;">
    <div class="row">
        <div class="col-lg-12">
          <div class="card">
            <div class="card-header">
              <div class="row" style="position: relative;">
                <div class="col-6 col-sm-4 col-md-2 col-xl mb-3 mb-xl-0">      
                    <h5 style="text-align: left;">
                        {{g?.QuestionGroupName}} 
                        <button type="button" 
                                class="btn btn-success mr-1" 
                                style="position:absolute;right: 10px;top:5px;"  
                                (click)="isCollapsed = !isCollapsed"
                                [attr.aria-expanded]="!isCollapsed" 
                                attr.aria-controls="qgroup-collapse-wrapper-g{{ei}}">
                            <i class="fa fa-align-justify"></i>
                            </button>
                    </h5>
                </div>
              </div>    
            </div>

...
 

The goal is to create a layout within the bootstrap card structure similar to the image linked here: https://i.sstatic.net/t3zyG.png

Highlighted columns indicating desired formatting:

  1. COLUMN #1 (ROW NUMBER COLUMN)
  2. COLUMN #2 ( TEXT COLUMN )
  3. COLUMN #3 (PROGRESS BAR DISPLAY COMPONENT )

Here is the relevant portion of the card body markup for reference:

...

However, I am facing challenges making the layout responsive and keeping the three-column structure centered. The responsiveness needs to match the layout shown in the image.

Update:

  1. How can I make the following div expand to fit within the card body?
  2. <div class="row justify-content-md-center" *ngFor="let q of g?.MyQuestions;let rnum=index" id="qrow_{{rnum}}_g{{ei}}" style="border: 0px solid red;display: flex;">
  3. How do I make "COLUMN #3 ( PROGRESS BAR DISPLAY COMPONENT )" span the remaining width of the column?

Additionally, the div with

<div class="row justify-content-md-center"
must be responsive so that all elements are displayed on a single line.

Answer №1

It seems like there may be some confusion.. Are you looking for the columns to stack vertically on smaller screens?


<div class="col-1">


<div class="col-7">


<div class="col-4">

You have the option to utilize Bootstrap column classes for different screen sizes to achieve this effect

Answer №2

Here's a suggestion:

<div class="card">
    <div class="card-body"><div class="row">
        <div class="col-sm-1"></div>
        <div class="col-sm-7"></div>
        <div class="col-sm-4"></div>
    </div></div>
</div>

In mobile width:

Try like this    

<div class="card">
    <div class="card-body"><div class="row">
        <div class="col-1"></div>
        <div class="col-7"></div>
        <div class="col-4"></div>
    </div></div>
</div>

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

Ways to implement CSS styling to every input element excluding inputs located within list items of a specific class

input.not(li.tagit-new >input) { background-color: lightgrey; } <ul id="tagAdministrator" style="width: 505px" class="tagit ui-widget ui-widget-content ui-corner-all"> <li class="tagit-new" style="box-shadow: none;"> <input ty ...

One way to conceal different sections of a Chart.js chart is by clicking on the legend

When using ChartJS, clicking on the legend will make the section disappear. Is it possible to reverse this behavior? For example, when clicking on the legend, all sections in the chart except for the clicked one should disappear. Does anyone have a sugge ...

Utilizing the Angular @HostListener to retrieve the current viewport width upon loading - a simple guide

Currently, I am utilizing the Angular @HostListener to retrieve the current width of the viewport onResize() in the following manner: @HostListener('window:resize', ['$event']) onResize(event?) { window.innerWidth <= 400 ? ...

Angular allows users to click on elements that have been dynamically added to the Document Object Model (DOM), such

Incorporating the ngx-bootstrap datepicker into my project was a game changer. I have a submit button positioned below the datepicker, and I have a specific goal in mind. I want the submit button to become active as soon as I select a date from the datepic ...

Hello there! I am just starting to learn about Bootstrap and I'm excited to create a responsive layout that will be centered on the page

I am aiming for this specific layout design. https://i.sstatic.net/JHvSY.png Here is the current code snippet that I have: <div class="container"> <h2 class="title mt-3 mb-4">Title</h2> <div class="container"> <div ...

AngularJS: Showcase HTML code within ng-view along with its corresponding output displayed in a navigation format such as Html, Css, JS, and Result

Currently, I am working on a web application. One of the screens, screen-1, consists of a series of buttons labeled 'Code'. When a user clicks on any of these buttons, it loads a different HTML page, screen-2, in the ng-view using $location.path( ...

Alignment of a Definition List with Omissions of Definitions

Often, I come across applications with forms containing optional fields. In the Show view, these fields tend to "collapse" together and lose alignment with their corresponding labels. For instance, if I have 3 fields that should be displayed as: Phone: 3 ...

flickering effect problem

What could be causing the issue where [@fadeInOut] only works on the initial page load when toggling isExpanded to hide or show content? Due to [@fadeInOut], the content stops showing up. Any thoughts on what might be causing this and any alternative solut ...

"Although disabled, input elements can still be focused on in Firefox browser

Illustrative example let userInput = document.createElement("input"); userInput.id = "user-input"; userInput.type = "number"; userInput.className = "user-number-input"; userInput.disabled = true; document.body.appendChild(userInput); .number-inp ...

Discover the ultimate guide to harmonize IE 9 with the ingenious Bootstrap Multiselect plugin developed by davidstutz

I've come across an amazing plug-in developed by David Stutz that allows for a Bootstrap and jQuery multi-select options list. Here are some resources: Check out the source code on Github Find documentation and examples here This plug-in works fla ...

Issue when attempting to update the background image using d3.js in browsers other than Firefox

I am experiencing a strange error that is puzzling to me. What I have done is placed a background image (SVG file) in a div using CSS. This SVG is used to create a Sprite animation, which is functioning correctly. .runner { background: url("0804_ ...

What is the process of invoking an external JavaScript function in Angular 5?

I recently downloaded a theme from this source. I need to specify script and CSS in the index.html file. The body section of index.html looks like this: <body> <app-root></app-root> <script type="text/javascript" src="./assets/js ...

iPhone having trouble loading additional css files

I'm struggling with web design and currently attempting to have iPhones load a different CSS file than desktops. After spending four hours on this task, I am starting to feel really discouraged. All I've been doing is <link rel="stylesheet" t ...

`Looking for a solution: Bootstrap failing to align right properly`

In my Bootstrap 4 project, I am facing an issue with aligning a label and an icon within a Card-Header. I want the Label to be left-aligned and the icon to be right-aligned, but for some reason, the icon is always attached to the label instead. Even when I ...

Angular HttpClient request fails to initiate

Overview: A button click on a form triggers the methodForm within the component. methodForm then calls methodService in the service layer. methodService is supposed to make an HTTP POST request. Problem: The HTTP POST request is not being made. However, me ...

Utilizing PrimeNg with Angular 2 to dynamically update charts using @ViewChild

I'm currently utilizing Angular2 with PrimeNG for my application. My dashboard includes charts and after attempting to upgrade to PrimeNG rc7 (from rc5) where they addressed an issue with updating charts, I'm facing challenges updating my chart d ...

What could be causing the incomplete transmission of data to the mongodb database?

Can anyone help me with my Angular CRUD operation issue? I am facing a problem where only the _id is being stored in the MongoDB database when trying to add a new person. The rest of the data is not getting sent completely. Here's my code: var expres ...

Implement a click event using jQuery specifically for Internet Explorer version 7

How can I add an onclick attribute using jQuery that is compatible with IE7? So far, the following code works in browsers other than IE8 and Mozilla: idLink = Removelst(); var newClick = new Function(idLink); $(test1).attr('onclick', null).clic ...

Ways to align text in a table row in a way that it remains positioned at the center of the screen's visible area

Can anyone assist me with this task? I need help centering text within a table row ('Some text here...') so that it always appears in the middle of the screen. The table will have horizontal scrolling. .compare-content { max-width: 480px; ...

Split Screen Text Comparisons

For some reason, I am finding it challenging to display two paragraphs side by side without disrupting the overall layout. If you would like a visual explanation of the issue, please check out this video: Video If you're interested in reviewing the c ...