Challenges with integrating a Bootstrap 4 table into a card component

Here is a problem I am facing.

It seems that the table inside the card is not displaying correctly. I want the table to be centered or at least eliminate the blank space that is currently showing. Here is my code (using Angular 6):

<div class="row">
          <div class="col-md-6">
            <div class="header">
              <h4 style="padding:10px" class="title">Dispositivo de Ejecucion</h4>
            </div>
            <div>
              <table class="table table-bordered table-condensed table-responsive ">
                <thead class="thead-dark">
                  <tr>
                    <th>Marca</th>
                    <th>Sistema Operativo</th>
                    <th>Version</th>
                    <th>Modelo</th>
                  </tr>
                </thead>
                <tbody>
                  <tr>
                    <td>{{dispositivoCdp[0].nombredispositivo}}</td>
                    <td>{{dispositivoCdp[0].sistema_operativo}}</td>
                    <td>{{dispositivoCdp[0].version}}</td>
                    <td>{{dispositivoCdp[0].modelo}}</td>
                  </tr>
                </tbody>

              </table>
            </div>
            

          </div>

          <div class="col-md-6 justify-content-center">
           
                <div class="header">
                    <h4 style="padding:10px" class="title">Tiempo de Ejecucion</h4>
                  </div>
            
                <table class="  table table-bordered table-responsive ">
                    <thead class="thead-dark">
                      <tr>
                        <th>Inicio</th>
                        <th>Fin</th>
                        <th>Duracion</th>
                      </tr>
                    </thead>

                    <tbody>
                      <tr>
                          <td>{{dispositivoCdp[0].nombredispositivo}}</td>
                          <td>{{dispositivoCdp[0].sistema_operativo}}</td>
                          <td>{{dispositivoCdp[0].version}}</td>
                          
                      </tr>
                    </tbody>
  
                  </table>
          </div>
          
        </div>

Any suggestions on what I might be doing wrong? I have tried using table-sm inside the table class but have not seen any results.

Answer №1

Make sure to include

 <table class="table table-bordered table-condensed table-responsive" style="display:table">

Answer №2

You should consider removing the "table-responsive" class from your code. It seems like that could potentially resolve the issue you are facing.

Answer №3

Your code may have a problem with the structure. In order to create a responsive table using Bootstrap 4, you need to nest it within a <div> that has the class table-responsive, instead of applying it directly to the table element.

For example:

<div class="table-responsive">
  <table class="table">
    ...
  </table>
</div>

For more information, refer to the documentation: https://getbootstrap.com/docs/4.6/content/tables/#responsive-tables

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

Embed a unique custom design sheet within a Facebook iframe

I'm looking to customize the design of my Facebook feed by adding a custom style sheet inside a Facebook iframe. Here's what I have: <iframe width="1000px" height="1000px" frameborder="0" name="f1e348592ed856c" allowtransparency="true" allo ...

Execute the CountUp function when the element becomes visible

Currently, I am implementing the following library: https://github.com/inorganik/ngx-countUp Is there a way to activate the counting animation only when the section of numbers is reached? In other words, can the count be triggered (<h1 [countUp]="345 ...

The background color feature of a div is malfunctioning

I have encountered a strange issue with one of my Div elements. When I add text inside the div, the background color sticks to the text. However, if there is no text present, the background color disappears. Image with Text: https://i.stack.imgur.com/oYK ...

I've encountered an issue when attempting to use innerHTML for DOM manipulation

I've been attempting to remove a specific list item <li> from the inner HTML by assigning them proper IDs. However, I'm encountering difficulties in deleting it. How can I delete these list items after clicking on the cross button? Feel fr ...

Error: The variable "Tankvalue" has not been declared

Is there a way to fix the error message I am receiving when trying to display response data in charts? The Tankvalue variable seems to be out of scope, resulting in an "undefined" error. The error message states that Tankvalue is not defined. I need to ...

What causes the failure of `click()` on a WebElement?

I am currently utilizing protractor within an angular application. The page model I have is structured as follows: export interface TileElement { idx: number; icon: string; title: string; element: WebElementPromise; } getModels() { //used as wfc. ...

Styling Labels with CSS Wildcard

I have been using the free NinjaForms plugin on my WordPress site. The default styling for labels is bold, but I prefer them to be lighter. Currently, I achieve this through CSS by targeting individual field IDs. However, this method becomes tedious when a ...

React Application not reflecting recent modifications made to class

My current project involves creating a transparent navigation bar that changes its background and text color as the user scrolls. Utilizing TailwindCSS for styling in my React application, I have successfully implemented the functionality. // src/componen ...

Tips for showcasing nested objects in Angular components

I'm faced with a situation where there is an object containing several nested objects, each with their own set of values. How can I display the key values from this complex data structure? I suspect using *ngFor might not provide the solution. const d ...

Switching List Icons when Hovering over Dropdown

Newbie Inquiry: I am working on a dropdown list featuring 10 items, each with black icons aligned to the right. I want to switch these icons to white when hovering over them. Appreciate any tips you may have! Thanks in advance! ...

How can you determine the class of an element that was clicked within an iframe?

Is it possible to retrieve the class of an element that is clicked within an iframe? Here is the HTML code: <input id="tag" type="text"> <iframe id="framer" src="SameDomainSamePort.html"></iframe> This is the JavaScript code: $(docum ...

Having trouble with your Angular CLI project after attempting to duplicate it by copy and paste?

As a newcomer to Angular, I've recently embarked on creating a new project using the Angular CLI. Everything was going well until I decided to upload my work to GIT. After copying and pasting the project folder contents into another directory, I encou ...

Is it possible to align divs so that they touch when they wrap to a new line, creating a grid-like appearance?

My React board component consists of an array of divs that I want to arrange in a grid-like map. The issue is, when the div wraps to a new line, there is significant space between each row. I aim to have the divs close together with no gaps. GameMap state ...

Guide to displaying or hiding elements based on the number of selected checkboxes

When only one checkbox is checked, all buttons in the head-btn class should be displayed. By default, only the add folder and upload buttons are shown. If a user selects two checkboxes, the share button should be hidden. If they uncheck one of the checkbo ...

The combination of two tags can create a powerful and impactful presence

My task is to place two <h3> tags in the same line or paragraph. <h3>This is the first paragraph. </h3> <h3>This is the second paragraph.</h3> I would like the output to look like this: This is the first paragraph. This is Se ...

Pictures are shown using the "text/html" layout

I'm having trouble identifying the error and have decided to carefully examine both the client and server code. It seems likely that there is a bug somewhere in Rails. The issue revolves around the photos being displayed in text/html format. Here&apos ...

The module 'atptest' could not be located or its corresponding type declarations are missing. Error code: ts(2307)

After creating an angular library using angular cli, I encountered an issue when trying to use it in any angular application after publishing it to npm. The published library installs successfully with the command: npm i atptest This is how I attempted t ...

Changing the width of select2 when it expands

My bootstrap v4 dropdown includes a select2 element that loads its options when triggered. Some of these options have long names, and I want the full width of the select2 to be displayed even if it exceeds the dropdown's width when opened. I attempte ...

The Angular component template does not reflect changes when new events are received from Firebase through onAuthStateChanged

I am facing an issue where the data I want to display on my "html" page does not show up initially. However, when I navigate away from the page and come back, the data appears. How can I troubleshoot this problem and find a solution? Below is my notificat ...

Issue with launching Angular 6 project

I attempted the solution from this link, but unfortunately, it did not work for me. I have cloned a project from GitLab and am attempting to run it. First, take a look at the output of my ng version command: https://i.sstatic.net/qxRzk.png. The project i ...