Remove default left and right padding in container fluid from Bootstrap 5


Fort Mohawk

I want to remove the default padding-left and padding-right in container fluid. I am using bootstrap 5. See screenshots. I disabled padding-left and padding-right by default and then got my desired result using chrome dev. tool. I don't want to use "!important" in CSS files. I also tried the no-cutter class with container fluid and also tried g-0 to remove the grooves in the container fluid, but it still doesn't work. While in the css file "!important" is associated with

    .container-fluid{
          padding: 3% 15% !important;
    }

It does work, but I don't want to use this solution. If there is any other way to solve this problem with Bootstrap 5.

/*********************************TAG SELECTOR***************************/
h1{
  font-family: 'Montserrat';
  font-size: 3rem;
  line-height: 1.5;
}

/*********************************CLASS SELECTOR***************************/
.navbar-brand, .nav-item{
    margin-left: 10px;
}

.container-fluid{
  padding: 3% 15% !important;
}

/*********************************ID SELECTOR***************************/
#title{
  background-color: #ff4c68;
}
<!DOCTYPE html>
<html>

<head>
  <meta charset="utf-8">
  <title>TinDog</title>

  <!-- Added Ubuntu & Montserrat font from Google font -->
  <link rel="preconnect" href="https://fonts.gstatic.com">
  <link href="https://fonts.googleapis.com/css2?family=Montserrat:wght@900&family=Ubuntu&display=swap" rel="stylesheet">

  <!-- Added CSS-->
  <link rel="stylesheet" href="css/styles.css">

  <!-- Added CSS bootstrap -->
  <link href="https://cdn.jsdelivr.net/npm/[email protected]/dist/css/bootstrap.min.css" rel="stylesheet" integrity="sha384-BmbxuPwQa2lc/FVzBcNJ7UAyJxM6wuqIj61tLrc4wSX0szH/Ev+nYRRuWlolflfl" crossorigin="anonymous">

  <!-- Added Javascript bootstrap-->
  <script src="https://cdn.jsdelivr.net/npm/[email protected]/dist/js/bootstrap.bundle.min.js" integrity="sha384-b5kHyXgcpbZJO/tY9Ul7kGkf1S0CWuKcCD38l8YkeH8z8QjE0GmW1gYU5S9FOnJ0" crossorigin="anonymous"></script>
</head>

<body>

  <section id="title">

    <div class="container-fluid">

      <!-- Nav Bar -->
      <nav class="navbar navbar-expand-lg navbar-dark">
        <a class="navbar-brand" href="#">tindog</a>
        <button class="navbar-toggler" type="button" data-bs-toggle="collapse" data-bs-target="#navbarScroll" aria-controls="navbarScroll" aria-expanded="false" aria-label="Toggle navigation">
          <span class="navbar-toggler-icon"></span>
        </button>
        <div class="collapse navbar-collapse" id="navbarScroll">
          <ul class="navbar-nav ms-auto">
            <li class="nav-item">
              <a class="nav-link" href="">Contact</a>
            </li>
            <li class="nav-item">
              <a class="nav-link" href="">Pricing</a>
            </li>
            <li class="nav-item">
              <a class="nav-link" href="">Download</a>
            </li>
          </ul>
        </div>
      </nav>

      <!-- Title -->
      <div class="row">
        <div class="col-lg-6">
          <h1>Meet new and interesting dogs nearby.</h1>
          <button type="button">Download</button>
          <button type="button">Download</button>
        </div>
        <div class="col-lg-6">
          <img src="images/iphone6.png" alt="iphone-mockup">
        </div>
      </div>
    </div>
  </section>

  <!-- Features -->
  <section id="features">
    <h3>Easy to use.</h3>
    <p>So easy to use, even your dog could do it.</p>
    <h3>Elite Clientele</h3>
    <p>We have all the dogs, the greatest dogs.</p>
    <h3>Guaranteed to work.</h3>
    <p>Find the love of your dog's life or your money back.</p>
  </section>

  <!-- Testimonials -->
  <section id="testimonials">

    <h2>I no longer have to sniff other dogs for love. I've found the hottest Corgi on TinDog. Woof.</h2>
    <img src="images/dog-img.jpg" alt="dog-profile">
    <em>Pebbles, New York</em>

    <!-- <h2 class="testimonial-text">My dog used to be so lonely, but with TinDog's help, they've found the love of their life. I think.</h2>
    <img class="testimonial-image" src="images/lady-img.jpg" alt="lady-profile">
    <em>Beverly, Illinois</em> -->

  </section>


  <!-- Press -->

  <section id="press">
    <img src="images/techcrunch.png" alt="tc-logo">
    <img src="images/tnw.png" alt="tnw-logo">
    <img src="images/bizinsider.png" alt="biz-insider-logo">
    <img src="images/mashable.png" alt="mashable-logo">

  </section>


  <!-- Pricing -->

  <section id="pricing">

    <h2>A Plan for Every Dog's Needs</h2>
    <p>Simple and affordable price plans for your and your dog.</p>


    <h3>Chihuahua</h3>
    <h2>Free</h2>
    <p>5 Matches Per Day</p>
    <p>10 Messages Per Day</p>
    <p>Unlimited App Usage</p>
    <button type="button">Sign Up</button>


    <h3>Labrador</h3>
    <h2>$49 / mo</h2>
    <p>Unlimited Matches</p>
    <p>Unlimited Messages</p>
    <p>Unlimited App Usage</p>
    <button type="button">Sign Up</button>


    <h3>Mastiff</h3>
    <h2>$99 / mo</h2>
    <p>Pirority Listing</p>
    <p>Unlimited Matches</p>
    <p>Unlimited Messages</p>
    <p>Unlimited App Usage</p>
    <button type="button">Sign Up</button>

  </section>


  <!-- Call to Action -->

  <section id="cta">

    <h3>Find the True Love of Your Dog's Life Today.</h3>
    <button type="button">Download</button>
    <button type="button">Download</button>

  </section>


  <!-- Footer -->

  <footer id="footer">

    <p>© Copyright 2018 TinDog</p>

  </footer>


</body>

</html>

screenshot

Zim

The problem is that styles.cssit should be bootstrap.min.cssafter the HEAD tag. Once this is done, the fill priority .container-fluidyou set will take precedence...

<head>
  <meta charset="utf-8">
  <title>TinDog</title>

  <!-- Added Ubuntu & Montserrat font from Google font -->
  <link rel="preconnect" href="https://fonts.gstatic.com">
  <link href="https://fonts.googleapis.com/css2?family=Montserrat:wght@900&family=Ubuntu&display=swap" rel="stylesheet">


  <!-- Added CSS bootstrap -->
  <link href="https://cdn.jsdelivr.net/npm/[email protected]/dist/css/bootstrap.min.css" rel="stylesheet" integrity="sha384-BmbxuPwQa2lc/FVzBcNJ7UAyJxM6wuqIj61tLrc4wSX0szH/Ev+nYRRuWlolflfl" crossorigin="anonymous">

  <!-- Added CSS-->
  <link rel="stylesheet" href="css/styles.css">

</head>

https://codeply.com/p/3VrA65Nv72

See also: How to override Bootstrap CSS styles?

Related


How to remove left and right padding of a list in SwiftUI?

FlowUI。SimpleUITesting.com: How to remove left and right padding of a list in SwiftUI? Every list I create has a border at the beginning and end of a cell. What modifier should I add to remove it? Tragically: .listRowInsetsIt doesn't seem to work with the line

Remove left/right padding on col-md-6 bootstrap

username I have a site that utilizes Bootstrap, but I want to override the left and right padding only for col-md-6 columns (set them to 0px). Not sure what to do, my current setup is... CSS .fix-gutters > [class^="col-"], .fix-gutters > [class*=" col-"] { p

Bootstrap container fluid div's right side beyond page wrapper

Blake Revere I'm trying to figure out why the margin-left class on the app-wrapper messes up the container fluid. The right side of the container fluid is pushed out of the page. The margin-left class is used to push the app-wrapper away from the 50px wide sid

How to remove left and right padding of a list in SwiftUI?

FlowUI。SimpleUITesting.com: How to remove left and right padding of a list in SwiftUI? Every list I create has a border at the beginning and end of a cell. What modifier should I add to remove it? Tragically: .listRowInsetsIt doesn't seem to work with the line

Remove left/right padding on col-md-6 bootstrap

username I have a site that utilizes Bootstrap, but I want to override the left and right padding only for col-md-6 columns (set them to 0px). Not sure how to do it, my current setup is... CSS .fix-gutters > [class^="col-"], .fix-gutters > [class*=" col-"] {

Remove left/right padding on col-md-6 bootstrap

username I have a site that utilizes Bootstrap, but I want to override the left and right padding only for col-md-6 columns (set them to 0px). Not sure what to do, my current setup is... CSS .fix-gutters > [class^="col-"], .fix-gutters > [class*=" col-"] { p

Remove left/right padding on col-md-6 bootstrap

username I have a site that utilizes Bootstrap, but I want to override the left and right padding only for col-md-6 columns (set them to 0px). Not sure what to do, my current setup is... CSS .fix-gutters > [class^="col-"], .fix-gutters > [class*=" col-"] { p

Highchart: Remove left and right padding in column chart

Jonas Schade I have an adjusted column chart pointPlacements, pointPaddingand groupPaddingan x-axis with a datetime and maxsum minvalues. The expected behavior is to slice the chart at the minimum and maximum values of the axis, but Highcharts seems to extend

container-fluid and side padding with Bootstrap 3

Andrew Koper I want my page's content to take up the full width of the screen with a little padding on the right and left and be fluid, but when I wrap my div.row and div.col-md-x in a <div class="container-fluid"> the page's content touches the sides of the s

How to remove default padding from Bootstrap navbar

username Bootstrap JS/CSS is appended with a transparent space NavBarinside the bottom of <td>my homepage. This shows a live preview of the problem with my default bootstrap configuration NavBars. This is complete (minus the bootstrap files) and a minimal exam

How to remove left and right padding of a list in SwiftUI?

FlowUI。SimpleUITesting.com: How to remove left and right padding of a list in SwiftUI? Every list I create has a border at the beginning and end of a cell. What modifier should I add to remove it? Tragically: .listRowInsetsIt doesn't seem to work with the line

How to remove default left and right padding in react native

Satyam Tripathi text image. I want to remove the left and right padding of the forgotten password Text. please help import React, { useState } from "react" import { View, Text, SafeAreaView, Button, StyleSheet, TextInput, TouchableOpacity, Platform } from

Remove left/right padding on col-md-6 bootstrap

username I have a site that utilizes Bootstrap, but I want to override left and right padding for col-md-6 columns only (set them to 0px). Not sure what to do, my current setup is... CSS .fix-gutters > [class^="col-"], .fix-gutters > [class*=" col-"] { paddi

Remove left/right padding on col-md-6 bootstrap

username I have a site that utilizes Bootstrap, but I want to override left and right padding for col-md-6 columns only (set them to 0px). Not sure what to do, my current setup is... CSS .fix-gutters > [class^="col-"], .fix-gutters > [class*=" col-"] { paddi

Highchart: Remove left and right padding in column chart

Jonas Schade I have an adjusted column chart pointPlacements, pointPaddingand groupPaddingan x-axis with a datetime and maxsum minvalues. The expected behavior is to slice the chart at the minimum and maximum values of the axis, but Highcharts seems to extend

Highchart: Remove left and right padding in column chart

Jonas Schade I have an adjusted column chart pointPlacements, pointPaddingand groupPaddingan x-axis with a datetime and maxsum minvalues. The expected behavior is to slice the chart at the minimum and maximum values of the axis, but Highcharts seems to extend

Remove the padding on the left and right sides of the grid system

Reese E96 I have a grid system that pads 10px between columns. But I don't want that padding to the left and right of the entire grid. I tried putting the columns in a big package and adding margin-left: -10px and margin-right: -10px, but it just moves the gri