What is the best way to divide a bootstrap card into two columns?

Currently, in my Angular 9 application, I have a component that utilizes Bootstrap cards. My objective is to create the following layout within this component:

For the desktop view, the layout should resemble the image below:

https://i.sstatic.net/3MGKm.png

While for the mobile view, the layout should look like this:

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

However, the code I've implemented did not render the expected layout depicted above. Here is a snippet of the code:

<div class="animated fadeIn" 
    style="margin-left: 2%;margin-right: 2%;margin-top: 2%;width: 80%;" 
    id="qgroup-div-g1">
    <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;">
                        Sample Header                  

                        <button type="button" 
                                class="btn btn-success mr-1" 
                                style="position:absolute;right: 10px;top:5px;"  
                                (click)="isCollapsed = !isCollapsed"
                                [attr.aria-expanded]="!isCollapsed">
                                <i class="mdi mdi-chevron-down"></i>
                        </button> 


                    </h5>
                </div>
              </div>    
            </div>

            <div [ngbCollapse]="isCollapsed" id="qgroup-collapse-wrapper-g1">
                <div class="card-body">
                     <ul>
                        <li>
                            <div class="row justify-content-md-center" id="row1" style="display: flex;">                
                                <div class="col-8">                        
                                    TEXT1
                                </div> 
                                <div  id="d_1" class="col-xs-auto">                     

                                    <AngularComponent  id="comp1"  
                                                value='10' 
                                                max="5" 
                                                color="blue" 
                                                size="40px"                                      
                                                (progress)="onProgress($event,'comp1', 1, 1 )">
                                    </AngularComponent>

                                </div>  
                            </div>
                        </li>
                        <li>
                            <div class="row justify-content-md-center" id="row2" style="display: flex;">                
                                <div class="col-8">                        
                                    TEXT2
                                </div> 
                                <div  id="d_2" class="col-xs-auto">                     

                                    <AngularComponent  id="comp1"  
                                                value='10' 
                                                max="5" 
                                                color="blue" 
                                                size="40px"                                      
                                                (progress)="onProgress($event,'comp1', 1, 1 )">
                                    </AngularComponent>

                                </div>  
                            </div>
                        </li>
                    </ul>
                </div>
            </div>

        </div>
    </div>
    <!--/.col-->
  </div>
</div>

Could someone please advise on how to achieve the desired layout mentioned above?

Answer №1

<!DOCTYPE html>
<html lang="en">
<head>
  <title>Unique Example</title>
  <meta charset="utf-8">
  <meta name="viewport" content="width=device-width, initial-scale=1">
  <link rel="stylesheet" href="https://example.com/bootstrap.min.css">
  <script src="https://example.com/jquery.min.js"></script>
  <script src="https://example.com/bootstrap.min.js"></script>
  <style>
    /* Custom styling for the webpage */ 
    .navbar {
      margin-bottom: 0;
      border-radius: 0;
    }

    .row.content {height: 450px}

    .sidenav {
      padding-top: 20px;
      background-color: #f1f1f1;
      height: 100%;
    }

    footer {
      background-color: #555;
      color: white;
      padding: 15px;
    }

    @media screen and (max-width: 767px) {
      .sidenav {
        height: auto;
        padding: 15px;
      }
      .row.content {height:auto;} 
    }
  </style>
</head>
<body>

<nav class="navbar navbar-inverse">
  <div class="container-fluid">
    <div class="navbar-header">
      <button type="button" class="navbar-toggle" data-toggle="collapse" data-target="#myNavbar">
        <span class="icon-bar"></span>
        <span class="icon-bar"></span>
        <span class="icon-bar"></span>                        
      </button>
      <a class="navbar-brand" href="#">Logo</a>
    </div>
    <div class="collapse navbar-collapse" id="myNavbar">
      <ul class="nav navbar-nav">
        <li class="active"><a href="#">Home</a></li>
        <li><a href="#">About</a></li>
        <li><a href="#">Projects</a></li>
        <li><a href="#">Contact</a></li>
      </ul>
      <ul class="nav navbar-nav navbar-right">
        <li><a href="#"><span class="glyphicon glyphicon-log-in"></span> Login</a></li>
      </ul>
    </div>
  </div>
</nav>

<div class="container-fluid text-center">    
  <div class="row content">
    <div class="col-sm-8 text-left"> 
      <h1>Welcome</h1>
      <p>Custom text highlighting unique features.</p>
      <hr>
      <h3>Test</h3>
      <p>Additional custom content...</p>
    </div>
    <div class="col-sm-4 sidenav">
      <div class="well">
        <p>ADS</p>
      </div>
      <div class="well">
        <p>ADS</p>
      </div>
    </div>
  </div>
</div>

<footer class="container-fluid text-center">
  <p>Footer Text</p>
</footer>

</body>
</html>

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

Is it possible to refresh Bootstrap using -bootswatch.scss?

As someone new to SCSS, I am currently in the process of transitioning a website from Bootstrap 3 to Bootstrap 4. In the past, with Bootswatch 3, all I had to do was replace the bootstrap.less and variables.less files with the theme downloaded from Bootswa ...

Is there a way I can link a variable to a URL for an image?

Creating v-chip objects with dynamic variable names and images is causing an issue. The image source string depends on the name provided, but when I bind the name to the source string, the image fails to load. Despite trying solutions from a similar questi ...

Application of Customized Bootstrap CSS Not Successful

I have noticed that my custom CSS file does not override the bootstrap.min.css unless I include the !important tag in the class. Specifically, when I try to change the color of my background header. .bg-grey{ background-color:#333 !important; } The ...

Tips for maintaining a single-line div while adding ellipses:

What is the CSS way to ensure that a div or class contains only one line of text, with ellipses added if it exceeds that limit? I am aware that setting a specific height and using overflow:hidden can achieve this, but it doesn't quite work for my need ...

Exploring the Google Drive API with Node

Currently, I am utilizing the Google Drive API in NodeJS. Below is the snippet of code I am using to download a file: try { const auth = await authenticate(); const drive = google.drive({ version: 'v3', auth }); drive.files.get( ...

Utilize background-size:cover and incorporate text in a horizontally scrolling webpage

Struggling to create a minimalist HTML layout with a horizontal scrollbar, featuring a large image on the left and a lengthy text with columns on the right? I suspect the issue lies in the implementation of position:relative with float, as well as position ...

Ensuring the title div is the foremost layer

So I have written the following code for my personal website: Here is the HTML: <html> <head> <meta charset="utf-8"> <title>My Website</title> <link rel="stylesheet" href="assets/css/style.css" ...

Images in Chrome are shivering when animated at unconventional positions

I am attempting to create a masking animation that reveals an image from its center. The animation is working well, but I have encountered a problem in Chrome where the revealed content shakes. Here is an example on jsfiddle: http://jsfiddle.net/BaKTN/ I ...

Is hard coding permissions in the frontend considered an effective approach?

I'm in the process of creating an inventory management system that allows admin users to adjust permissions for other employees. Some permissions rely on others to function properly, and I need to display different names for certain permissions on the ...

Building a Bootstrap Tooltip

Here is a brief code excerpt: link HTML CODE: <a href="#" data-toggle="tooltip" title="Hooray!">Hover over me</a> asda example link I am puzzled by the discrepancies between my implementation and the one on W3Schools. I have used the sam ...

I am experiencing an issue with the date selector within the table

<td class="col-50 text-right"> @Html.ngTextBox(ControlType.Date, true, "txtExpDate", null, new { @ng_model = "PharmacyStockInDetail.ExpDate", @class = "form-control", @data_smart_datepicker = "", @data_date_format = "{{Format.Smart ...

Using CSS box-shadow to elevate an image

I am looking to create a background wrapper using CSS instead of an image. My goal is to add box shadow to achieve the same look as shown in the attached image. I understand that I will need to use the box-shadow property for this task. However, I am uns ...

Tips for adding event listeners to dynamically-loaded content using AJAX

I need help with the following code snippet: $("#contantainer").load("some_page.txt"); Inside some_page.txt, I have the following content: <div class="nav"> <ul id="nav_ul"> <li><a class="nav_a" href="#home" id="home"> ...

Storing Images in MongoDB Using the MEAN Stack

Currently, I am in the process of developing an angular application that utilizes a MongoDB based Database. One of the features I am working on involves allowing users to upload files and store them in the DB. The drag and drop UI has been implemented succ ...

Tips for activating scroll feature for certain section of an HTML page

For the styling of my page, I'm utilizing Scss and am facing an issue related to setting up scrolling for specific sections of an HTML page. You can check out the image reference here. During a scroll event, I want to ensure that the Categories (left ...

Modify the CSS color attribute interactively by clicking

I have a function that can generate random colors. I would like to utilize this function along with jQuery's toggleClass feature to change the color of a table cell when clicked, and revert it back to its original color if clicked again. Here is the ...

When passing parameters through a URL in TypeScript, the display shows up as "[object object]" rather than as a string

Hey there! I'm trying to pass some string parameters to my URL to fetch information from an API. Everything seems fine, and when displayed in an alert, the URL looks exactly as it should (no [object, object] issue). var startDate = "2020-09-20"; var ...

The Bootstrap table spills off the page and the navbar fails to align properly with the screen

A complex question awaits your attention. I must clarify that I lack the expertise of a professional web developer. I have already attempted the solutions referenced here and here The provided image represents the mobile view, whereas the desktop view app ...

Difficulty in modifying a global variable within an event handler

I am working on an ionic4 app that includes a button. The goal is to display the accelerometer alpha value when the button is pressed. However, I am encountering an issue where the event handler invoked by the event listener does not seem to update the g ...

Dynamic input fields with autocomplete functionality

I have attempted to implement the solutions provided elsewhere on this specific issue, but unfortunately they do not seem to be working for me. It is highly probable that I am making some mistake in my approach... My main objective is to achieve what is me ...