Differences in row padding when transitioning from Bootstrap 3 to Bootstrap 4

One thing I've noticed is that when utilizing Bootstrap 3, the use of div.row would automatically create a vertical spacing between rows which was quite appealing. However, upon transitioning to Bootstrap 4, this automatic spacing seemed to disappear.

https://i.sstatic.net/A9p9R.png Here we have Bootstrap 4 in action.

https://i.sstatic.net/kV3ww.png And here is Bootstrap 3 for comparison.

Below is my code using Bootstrap 4:

<div class="container">
  <div class="page-header col-8 offset-2">
    <h1>{{ title }}</h1>
  </div>

  <div class="row">
    <div class="col-8 offset-2">
      <ul class="list-group" *ngIf="showCities">
        <li class="list-group-item"
            *ngFor="let city of cities">{{ city.name }}
        </li>
      </ul>
    </div>
  </div>

  <div class="row">
    <div class="col-8 offset-2">
      <div class="input-group">
        <input type="text"
               class="form-control"
               placeholder="New city.."
               #newCity
               (keyup.enter)="addCity(newCity.value)">
        <span class="input-group-btn">
            <button class="btn btn-success"
                    type="button"
                    (click)="addCity(newCity.value)">Add</button>
        </span>
      </div>
    </div>
  </div>
</div>

I'm currently trying to figure out how to achieve the same spacing effect as seen with Bootstrap 3. I've added Bootstrap to my package.json and it's compiling fine in a new ng-cli project. Since I'm using sass, is there a way to override some variables or maybe my Bootstrap 4 code needs adjustment?

Answer №1

Bootstrap 4.x has made changes to the list-group by removing the margin-bottom style that was present in Bootstrap 3.

To add margins to the list-group in Bootstrap 4.x, you can utilize the new spacing utilities. For instance, using mb-4 will apply a bottom margin of 1.5rem;...

<div class="row">
        <div class="col-12">
            <ul class="list-group mb-4">
                <li class="list-group-item">Bootply</li>
                <li class="list-group-item">One itmus ac facilin</li>
                <li class="list-group-item">Secondp t eros</li>
            </ul>
        </div>
</div>
<div class="row">
        <div class="col-8">
            <div class="input-group">
                <input type="text" class="form-control" placeholder="Nieuwe stad..">
                <span class="input-group-btn">
            <button class="btn btn-success" type="button">Toevoegen</button>
        </span>
            </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

Text within cells is not wrapping onto a new line in an HTML table

Let me show you how it currently looks: https://i.sstatic.net/OeHRg.png The maximum width of the cell is working properly, but the text is not wrapping to a new line as expected. Instead, it overflows out of the cell. Here is the CSS applied to the tabl ...

Warning thrown by jsHint: 'Firebase' is not defined

How can I properly define Firebase to stop JSHint from beeping? My code is functioning fine... it's just JSHint that's annoying app.js angular .module('morningharwoodApp', [ 'firebase', 'ngAnimate', & ...

Having issues with the functionality of my radio button in AngularJS

As I delve into Angular and experiment with some code, I am focusing on implementing the following functionality: 1. Depending on the user's preference for adding additional details, they can choose between 'yes' or 'no' using radi ...

Display a div when a selection is made from the dropdown menu - using Ionic

Upon running this code, the expected behavior is to display the second div when an option is selected from the first dropdown list. Similarly, selecting an option from the second dropdown list should reveal the third div. However, the third div does not ap ...

Encountering a problem with serializing forms using jQuery

Currently, I am working on form serialization in order to send the file name to the server. However, I have encountered an issue where the serialization values are empty and I am expecting the file name to be included. Within my form, there is an HTML fil ...

Maintaining the footer and bottom section of the webpage

I am facing an issue with the footer on my website . I want the footer to always stay at the bottom of the page, even when I dynamically inject HTML code using JavaScript. The footer displays correctly on the main page , but it does not work as intended on ...

tips on sending multiple data- id in a modal window

Let's say I have multiple order IDs $order_id='12345566778'; $prod_id='126778899'; $sell_id='373462562363'; When I select a particular order ID, I want to pass it to a PHP variable located in the modal body of a popup. ...

My website was unexpectedly adorned with an additional quotation mark by Chrome

Unexpectedly, Chrome inserted a quote that was not part of my code. Upon pressing F12 in Chrome, the added code is revealed. This extra quote caused a mysterious space at the top of my website. Removing the unnecessary quotes resolved the issue and everyt ...

Creating a custom action in AngularJS $resource to request a password reset

Recently, I've started incorporating ngResource into my project to interact with RESTful endpoints. However, I'm a bit unsure about how to implement a user password reset using $resource. It seems strange to pass the email address as a URL parame ...

Creating a mobile-friendly split column layout with Bootstrap 5

I have a similar question to the one posed in this thread How to split Bootstrap column in mobile mode, but I am working with Bootstrap 5 and the previous solution using float: right no longer works due to flexbox. On desktop, I have two columns and I wan ...

Leveraging AngularJS ng-model for bidirectional data binding to display the name of a Stripe plan based on its plan

On the final page of a checkout process labeled "Review & Checkout," I am showcasing form inputs. Here, I display the selected plan and the customer's personal information entered so far. While displaying fields such as Name or Email is straightf ...

Unable to $delete within nested angularfire controllers

Utilizing angularfire, I am managing a series of online courses where each course contains multiple lectures. I have structured the lectures as nested within their respective courses. The factory I have implemented successfully enables CRUD operations for ...

Disappearing input field in DateTimePicker Bootstrap when blurred

Currently, I am utilizing the Bootstrap DateTimePicker plugin to enable users to select a specific date and time. The plugin functions well with one minor issue - whenever the user clicks outside or loses focus on the calendar box, both the box itself and ...

How to handle an InputStream with zero file length in Java using the Spring framework

I am facing an issue with my REST application that has a client implemented in Angular and a server built with Spring. When I try to send a file using an async request, I end up receiving a 0-length file. It's perplexing because the header displays th ...

The dropdown menu vanishes from sight as soon as the cursor moves away from a link

Recently, I encountered an issue while trying to create a dropdown menu using Jquery. The problem arose when attempting to select the second link, as the entire menu would disappear. Additionally, is there a way to ensure that only one dropdown menu is vis ...

Having trouble injecting $ionicHistory into my AngularJS controller

I am encountering an issue with using $ionicHistory.goBack() in a Controller within my Angularjs/Ionic application. Upon attempting to inject it into my controller as shown below app.controller('ClockInController', function($scope, $http, JobDat ...

I am looking to display an image as a value in the dropdown menu of my Contact Form 7 on my WordPress website

I am currently working on a Wordpress website where I have a page showcasing 50 different company logos. Below the logo section, there is a form created using Contact Form 7. The logo section was built using a combination of HTML and CSS. Within the form ...

The onBlur event attached to a div is triggered when transitioning from one input element to another within the same div

Here's a scenario: I have a div with two input fields nested inside, like this: <div> <input placeholder="Input1"/> <input placeholder="Input2"/> </div> I have a requirement to trigger a specific ...

What is the best way to create a function that triggers another function every minute?

Currently, I have a function that checks if a user is authenticated: isAuthenticated = (): boolean => { xxx }; I am working with AngularJS and I want to create a new function called keepCheckingAuthentication() This new function should call the ...

Unable to access controller using jquery/ajax in CodeIgniter along with a bootstrap template

When loading a page into another, everything seems to be working fine except for the controller loading: The scripts and CSS are being loaded in the default page code, which might be causing the issue. The error message "Failed to load resource: the serve ...