Eliminate unnecessary white space in Bootstrap styling

While coding in bootstrap, I needed to move the button up towards the horizontal bar.

see image here

<div class="separator-breadcrumb border-top"></div>

<div class="row">
   <div class="col-12">
      <div class="card mb-4">
          <div class="card-body">
              <div class="card-title d-flex align-items-center justify-content-end">
                  <button (click)="showPreviousYear()" *ngIf="showPreviousYearButton()" class="btn btn-primary ">
                      &lt; {{previousYear}}
                  </button>
                  <button (click)="showNextYear()" *ngIf="showNextYearButton()" class="btn btn-primary mx-1">
                      {{nextYear}} &gt;
                  </button>
              </div>
              <div class="table-responsive" *ngIf="lines.length > 0">
                  <table class="table table-striped">
                      <thead>
                          <tr>
                              <th scope="col" style="width: 25%;">{{'4391' | t}}</th>
                              <th scope="col" style="width: 25%; text-align: right;">{{'4392' | t}}</th>
                              <th scope="col" style="width: 25%; text-align: right;">{{'4393' | t}}</th>
                              <th scope="col" style="width: 25%; text-align: right;">{{'4394' | t}}</th>
                           </tr>
                       </thead>
                       <tbody>
                           <tr *ngFor="let line of lines; let i = index">
                              <th style="width: 25%;">
                                    {{line.LIBELLE}}
                              </th>
                               <td style="width: 25%; text-align: right;">
                                    {{line.TAUX | number:'1.2-2' | mynamformatnum}} %
                               </td>
                               <td style="width: 25%; text-align: right;">
                                    {{line.BASE | number:'1.2-2' | mynamformatnum}} EUR
                               </td>
                               <td style="width: 25%; text-align: right;">
                                    {{line.MONTANT | number:'1.2-2' | mynamformatnum}} EUR
                               </td>
                          </tr>
                       </tbody>
                  </table>
              </div>

                <h5 *ngIf="lines.length == 0">
                    {{'4395' | t }}
                </h5>
            </div>
        </div>
    </div>
</div>

I included a new class called btn-top in the CSS file

<button (click)="showPreviousYear()" *ngIf="showPreviousYearButton()" class="btn btn-primary btn-top">

This is how it appears now:

.btn-top {
    position: relative; 
    top: -100px;
}

Currently, I am trying to remove the white space from the table but couldn't find the appropriate bootstrap class for that. Any suggestions?

image link here

Answer №1

To ensure proper alignment of buttons, place them alongside the heading and separate them using col-6 classes.

For instance:

<div class="row">
                <div class="col-6">
                   <h3 class="title">Taxes</h3>
                </div>
                <div class="col-6">
                    <a href="javascript:void(0)" role="button" class="btn btn-bold btn-sm btn-success">button</a>
                </div>
            </div>

To eliminate unnecessary space caused by Bootstrap cards' default padding, use the p-0 class.

For example:

<div class="card-header p-0">
  <div class="card-body p-0">

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 there a way to make the footer adapt to the varying heights of the grid sections as they grow in size?

Currently, I am facing an issue with the positioning of the page footer. Despite my efforts, it does not remain at the bottom as intended. Please refer to the image for a visual representation of the problem. How can this be rectified? It is worth noting ...

Identify the location of the mouse and activate a specific function based

Tracking the x-coordinate of the mouse is crucial in this scenario. When the mouse approaches a specific threshold (250px) towards the left edge of the window, it should trigger the function "openNav." The function should close when the mouse moves away fr ...

"Creating a Customized Justified Navigation Menu with Bootstrap

Trying to implement a justified bootstrap nav using bootstrap 3.3? Check out this link for guidance! If you want to see a working demo, click the link below: View the code on CodePen here. After downloading and exporting the code, some users have f ...

Just built a React App including a blog functionality, but for some reason the blog posts are not showing up. Any suggestions on how to fix this issue

I'm currently working on a project that involves creating a blog page for our react app. Despite my efforts, I am facing difficulty in getting the blog posts to show up. In order to retrieve all the posts from my MYSQL database, I have set up an API ...

Perform JavaScript Actions upon Submission of a Stripe Form

I have implemented a custom checkout button for Stripe and I am looking to trigger a JavaScript function after the checkout process is successfully completed. Specifically, I want the function to change the style of the "book-appointment-button" from "no ...

Dynamic Video Player

Trying to embed a YouTube video on your webpage? Most sources suggest using the following code: HTML <div class="video-container"><iframe.......></iframe></div> CSS .video-container { position:relative; padding ...

Issue with Bootstrap 2-column layout not functioning properly on mobile devices

I have been working on Bootstrap and I am facing an issue with the positioning of two badges. Currently, one badge appears on the right side and the other on the left side. Although I tried adjusting the left property, it causes overlapping when the size ...

Utilize the cakePHP HTML input helper to assign specific values from 2 arrays

I am working on creating 2 arrays from a model for an edit page. One array contains values already selected by the user, while the second array contains available values that the user can choose from. My goal is to populate a multi-select input box with ...

Tips for streaming an mp3 file on the internet

Is there a way to play an MP3 on a webpage without allowing users to download it? ...

Having difficulty aligning Divs perfectly?

I'm struggling to center four green divs that have a float left, surrounded by a wrapper div in blue. I want them to be aligned a certain way, but on larger screens, they are not displayed in the center. I need them to float underneath each other when ...

How to reference a ListView control using its DataSource in a C# class

Currently, I have a ListView embedded in a webpage connected to a C# class datasource called CommentsDAO. This class contains the necessary methods to retrieve or delete data from the ListView. While data retrieval is successful, deleting a row proves to b ...

What could be causing my CSS to malfunction when I include two parameters in app.get?

While developing an express app, I encountered an issue where my CSS code stopped working whenever I added an ":ID" parameter to the URL. It seems like a filepath problem because bootstrap is still loading fine, but on the specific page with the ID paramet ...

"Setting a maximum height for a div element, along with nested divs and paragraphs

.wrap { width:400px; height:200px; border:1px solid #000; } .content { width:300px ...

Managing Cache Expirations

When I checked my website's performance using Google Webmaster Tools' PageSpeed analyzer, it highlighted that none of my resources were being cached. Here is the code snippet from my .htaccess file sourced directly from H5BP. I'm wondering i ...

Is there a way to save the ID of an anchor tag after clicking on it, in order to use it at a later time?

I have a variety of listings on my website, structured like this: <a class="listing" id=""></a> <a class="listing" id=""></a> <a class="listing" id=""></a> Each listing contains unique data and IDs retrieved from my da ...

Enhancing the appearance of the CSS panel with Font Awesome icons

I need help adding a fontawesome or any other icon to my CSS3 based sliding panel button. The icon should change from open to close when clicked on. Any ideas on how to achieve this would be greatly appreciated! * { margin:0; padding:0; font-famil ...

Streamlined approach to triggering ng-change on a single textbox

Consider this array within an angular controller: somelist = [ { name: 'John', dirty: false }, { name: 'Max', dirty: false }, { name: 'Betty', dirty: false } ]; To iterat ...

Customizing the navbar-brand logo and navigation links in Bootstrap 3 for optimal display in FireFox version 31

I'm encountering an issue with Firefox 31.0 where, after scaling down my browser to the mobile version and clicking on the drop-down icon, my navigation items shift to the right of my logo. This problem is specific to Firefox 31.0 and does not occur i ...

Please provide a validation error message when attempting to select a dropdown list while the checkbox is unchecked

There are 7 drop down menus in a table row. When trying to select a value from the drop downs with the checkbox unchecked, a validation message should be displayed saying "Please enable the checkbox". If the checkbox is checked, all the drop down menus sh ...

What is the best way to resize the mat-form-field mat-chip?

This is the result of my HTML coding https://i.sstatic.net/2KOvk.png I am trying to achieve uniform size for the mat-chip form field similar to the one above. I referenced this location for using chips. I am looking to reduce the size of the chip in the ...