Exploring ways to incorporate zero padding exclusively for mobile devices through Bootstrap

On mobile sm devices, I am trying to achieve padding: 0, but so far nothing has worked.

I referenced this post on Stack Overflow and also attempted the code below:

The default padding of 15px on the right and left for col-*-12 is causing issues. I only want this padding value to be zero on mobile devices.

To clarify further, I need the padding to be zero only on mobile devices, while on all other devices it should adhere to the padding from col-*-12.

Here is a brief example of what I have tried:

Just for your information (FYI)

Using the class col-lg-12 col-md-12 px-0 px-md-2, I can achieve padding: 0 on mobile devices. However, I do not want to override the padding-right and padding-left properties from col-*-12. I would like to utilize the padding from col-*-12.

<link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/4.4.1/css/bootstrap.min.css" integrity="sha384-Vkoo8x4CGsO3+Hhxv8T/Q5PaXtkKtu6ug5TOeNV6gBiFeWPGFN9MuhOf23Q9Ifjh" crossorigin="anonymous">
<div class="container-fluid bg-white shadow-sm pt-3">
  <div class="row">
    <div class="col-lg-12 col-md-12 px-4 px-sm-0">
      <nav aria-label="breadcrumb">
        <ol class="breadcrumb shadow-sm rounded-0-sm">
          <li class="breadcrumb-item"><a href="/">Home</a></li>
          <li class="breadcrumb-item">
            <a href="/ads/car/">
              this is categroy
            </a>
          </li>
          <li class="breadcrumb-item">
            this if file name
          </li>
          <li class="breadcrumb-item text-secondary text-wrap text-break">
            cate file name
          </li>
        </ol>
      </nav>
    </div>
  </div>
</div>

Answer №1

When it comes to mobile devices, remember that they have an xs size and not sm.

If you are working on a mobile view, consider using the following code snippet:

<div class="container-fluid bg-white shadow-sm pt-3">
  <div class="row">

    // For mobile devices, utilize the xs property
    <div class="col-lg-12 col-md-12 px-xs-0 px-sm-4">
      <nav aria-label="breadcrumb">
        <ol class="breadcrumb shadow-sm rounded-0-sm">
          <li class="breadcrumb-item"><a href="/">Home</a></li>
          <li class="breadcrumb-item">
            <a href="/ads/car/">
              This is the category
            </a>
          </li>
          <li class="breadcrumb-item">
            The file name goes here
          </li>
          <li class="breadcrumb-item text-secondary text-wrap text-break">
            Category file name
          </li>
        </ol>
      </nav>
    </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

Looking for advice on designing a unique Gallery layout using CSS?

Tasked with converting various layouts, some of which utilize a specific layout pattern (refer to the image below.) I'm seeking advice on the most efficient way to use CSS to display a list of images in this manner without dividing items into separate ...

The CSS slider is stuck on the fifth slide and won't move past it

I encountered an issue with the CSS slider I am using, as it only had five radio buttons / slides in its demo. After attempting to add more slides, I noticed that the slider was not scrolling to the new slides. I'm unsure where I made a mistake in m ...

A step-by-step guide on building an interactive settings page for your Chrome extension

I am looking to develop an options page that features dynamically generated options. My goal is to extract data from a web page's source using my content script and then display this data on the options page. How can I effectively transfer this data ...

What is the correct method for including the sanitize: false option in a popover?

Struggling to place a button within the Bootstrap Popovers? I attempted but failed. Currently using Bootstrap-Popover and aiming to include a button within the popover. var popoverTriggerList = [].slice.call(document.querySelectorAll('[data-bs-tog ...

Angular's browser animation feature allows for smooth slide-up animations from the bottom

I have been experimenting with creating a simple animation, and it's working, but in the opposite direction of what I intended. I want the div to open from bottom to top and close from top to bottom. Here is my animation code in Angular: animations: ...

What is the best way to create a clickable button link using PHP echo?

Whenever I click the button, it always redirects to just story.php, ignoring all other details. I attempted using JavaScript but I found that utilizing form action is the closest method for me to accomplish this: <form action='./story.php?u=$id&a ...

Developing websites using Bootstrap 4 and React, with the added feature of a

Having trouble making a pre/code block multiline in a React 16 app created with create-react-app and Bootstrap 4. I've followed the Bootstrap documentation on code blocks, but it doesn't seem to work in my environment. The code works fine when t ...

flexbox with a table that can be scrolled vertically

I am currently working on creating a scrollable tbody within a flexbox layout. I have two flexboxes, each containing a table. When the items in the table overflow, I want to display a vertical scrollbar within the tbody. However, the tables are within f ...

Tips for displaying an array and iterating through its children in Angular 7

I am currently working on extracting the parent and its children to an array in order to display them using ngFor. However, I am encountering an issue where the children are not being displayed during the ngFor. I have a service that retrieves data from a ...

Cosmic CSS Unveilment

Currently working on building a responsive HTML page and facing a slight challenge. I have two divs that I want to display side by side. If the width drops below X, the second div should be hidden. This part is functioning as expected. However, when in ...

What is the origin of the trailing commas seen in these radio button choices?

After closely examining my radio buttons, I noticed a strange issue - there is an unexpected trailing comma after each option. Strangely, I did not add these commas in the template and I cannot figure out where they are coming from. Initially, I suspected ...

Designing Post Archive with Flexbox to create dynamic layouts

I am currently exploring different techniques to style my columns, and I have encountered an issue where if there are less than 4 posts in a row, there is extra space between each post. While I understand that floats can resolve this problem, I am searchin ...

Adjacent components

I have a query regarding the utilization of Angular. I aim to align the sentences side by side. These are two distinct components that I developed. I wish for recipe-list and recipes-details to function properly, with both statements displayed alongside ...

Applying identical values to multiple properties (CSS)

Can we assign a single value to multiple CSS properties at once? border-left, border-right: 1px solid #E2E2E2; Similar to how we can with selectors? .wrapper, .maindiv { ... } ...

Selecting an item from a dropdown menu using Selenium

Currently, I am tackling a test automation scenario that presents a challenge. Within a web form, there is a dropdown menu containing various items. My task is to select a specific item based solely on the expected content. I aim to choose 'PostgreS ...

Is it possible to place a div and a heading side by side within the same line?

Is there a way to align a div and header on the same line? Currently, the red div is displaying below the text. Thank you for your help! .underlined { border-bottom: 1px dotted #000; text-decoration:none; } .block { height:15px; background-color: #ff505 ...

Tips for designing a unique HTML form and validating it with jQuery for a specific scenario

Seeking guidance as a beginner in web development, I am currently utilizing HTML, jQuery, and PHP for my website. My first task involves designing a form and implementing jQuery validation to achieve the following goals, followed by generating a URL to be ...

Is there a way to restrict access to my website to only be opened in the Chrome browser?

Is there a way to prevent my web application from loading when the link is opened in browsers other than Chrome? Can this be achieved using Javascript or Java? I want to restrict the usage of my web application to only Chrome. Any assistance would be appre ...

I'm encountering difficulties with customizing the root styling of material-ui's DialogActions

Check out the two buttons in a DialogActions just like this. This is the JSX snippet I'm working with: <DialogActions classes={{ root: classes.dialogActionsLeft }}> <Button autoFocus onClick={() => { setOpen(false); }} ...

What is causing this particular area to remain unaffected by the blur effect?

issue I followed a tutorial to create a mouse trailer from this video - https://www.youtube.com/watch?v=kySGqoU7X-s. However, when I tried adding text and other elements inside a div, the blur effect just didn't show up. I attempted using z-index but ...