Learn how to incorporate unique breakpoints in Bootstrap 4 and effectively utilize responsive breakpoint mixins in SCSS for a tailor-made responsive design

I am currently developing an Angular 5 application that requires responsiveness. I am encountering difficulties in making it responsive for different resolutions such as 1366X768 and 1920X1080 where font sizes vary.

Issue 1: I have customized breakpoints in my style.scss as shown below:

$grid-breakpoints: (
  xs: 0,
  sm: 576px,
  md: 768px,
  lg: 992px,
  xl: 1200px,
  xxl:1900px //this is custom breakpoint; after compiling bootstrap does generates col-xxl-* classes
);

I added xxl as a new breakpoint. However, when I assign the col-xxl-* class to an element, it takes full width just like col-12 does. See the image below : https://i.sstatic.net/E8ZSo.png

Even though I gave the container with a red border the col-xxl-3 class, it still takes full width. Why aren't the responsive grid classes related to col-*-3 being applied? It should generate CSS like this:

.col-xxl-3 {
    -webkit-box-flex: 0;
    -ms-flex: 0 0 25%;
    flex: 0 0 25%;
    max-width: 25%;
} 

But it doesn't. Am I doing something wrong?

Issue 2

According to the Bootstrap responsive breakpoints, we can use mixins to target different resolutions. In the component-level SCSS, I used these mixins as follows :

@import '~bootstrap/scss/_functions.scss';
@import '~bootstrap/scss/_variables.scss';
@import '~bootstrap/scss/_mixins.scss';

span.work_catalog {
    @include media-breakpoint-up(xl) { //this will target all above 1200 px as per bootstrap documentation; so this works as you see red border in the above image
       border:1px solid red;
    }
}

However, when I tried to use it like this :

span.work_catalog {
        @include media-breakpoint-up(xxl) { 
           border:1px solid red;
        }
    }

it still applies for resolutions above 1200px. I expected the CSS to only apply for resolutions above 1900px since I added a custom grid breakpoint in my style.scss. Am I missing something here?

Answer №1

To include a new xxl breakpoint, follow these steps. Ensure that you @import bootstrap after defining the custom grid-breakpoints...

@import "bootstrap/functions";
@import "bootstrap/variables";

$grid-breakpoints: (
  xs: 0,
  sm: 567px,
  md: 768px,
  lg: 992px,
  xl: 1200px,
  xxl: 1900px
);

$container-max-widths: (
  sm: 567px,
  md: 768px,
  lg: 992px,
  xl: 1200px,
  xxl: 1900px
);

 @import "bootstrap";

Example:

Subsequently, the corresponding xxl-* classes will be created...

@media (min-width: 1900px) {
    .col-xxl-3 {
        flex: 0 0 25%;
        max-width: 25%;
    }
}

To define custom mixin classes, specify them after importing bootstrap...

@import "bootstrap";

span.work_catalog {
    @include media-breakpoint-up(xxl) { 
       border:1px solid red;
    }
}

Example: (observe that the demo establishes the xxl breakpoint as 1366px) so once the screen widens beyond xxl, .work_catalog showcases the anticipated red border.

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

Can the arrangement of divs be altered solely based on specific browser widths, rather than just for visual appeal?

Imagine having the following HTML structure: <div class="outer"> <div class="inner"> </div> </div> However, under the condition @media (min-width: 890px) and (max-width: 958px), you want it to look like this: <div clas ...

Retrieve the parent document for every item within a Firebase collection group

Transitioning from an SQL background to document storage, I am currently navigating through a Firebase database structure that looks like this: John (doc) Restaurant Reviews (collection) Review 1 (doc) Review 2 (doc) Paul (doc) Restaurant Reviews ...

Potential breakpoint (Breakpoint established but not yet linked)

My experience with debugging my Angular app in Chrome was going smoothly through the Chrome Debugger extension with automatic settings. However, something changed after a Windows 7 reboot and all my breakpoints became inactive. I suspect this was due to a ...

Explain the functionality of the Angular EventListener that is triggered on the scroll event of

Currently, I am exploring ways to track the position of the navbar beneath the landing page. The goal is for the navbar to become sticky at the top once it reaches that position until you scroll back up. Despite trying various solutions on Stack Overflow a ...

Module not found when attempting lazy loading routing in Angular2 RC5

Having some challenges implementing RC5 changes in my app, particularly when it comes to lazy loading modules within the routing. Here's the file structure for the affected files in my app: /app /components/meda/meda.module.ts /components/meda ...

Issue with displaying Bootstrap 3 modal on Mozilla browser

Hello everyone, I've encountered an issue with my Bootstrap modal on Mozilla browser. Everything works perfectly on Chrome and Safari, but when I click the modal button in Mozilla, nothing happens. Here's a snippet of my code: <button type="b ...

Issue with Bootstrap input-group-prepend functionality not functioning as expected

I've been diligently studying the official documentation and exploring various examples shared by others who have encountered similar issues, but unfortunately, I haven't been able to find a solution yet. In the official documentation, everythin ...

Display an image with only a portion visible, no canvas, no frame, and no need

My dilemma involves an img with a surrounding box div. http://jsfiddle.net/6d4yC/7/ 1) I am seeking to display only a portion of the image (250x150) without generating a white overlay when it is in its large size. Placing a #box1 div around the image has ...

Issue arises when attempting to utilize the Angular2 File Uploader feature found at http://ng2-uploader.com

Just starting out with Angular 2 and trying to upload a file using . Followed the documentation and README file instructions, but encountering this error in the browser: GET http://localhost:3000/ng2-uploader 404 (Not Found) (SystemJS) XHR error (404 Not ...

Struggle with incorporating a file

As part of the login process, I have two options available: easy login and standard login. The easy login requires an employee ID, birthdate, and captcha answer, while the standard login asks for first name, last name, birthdate, and captcha. To facilitate ...

When creating a FlipCard, you may encounter the error message "The object may be null" while using the document.querySelector() method

Having trouble creating a flipcard on Next.js with tsx. The querySelector('.cardflipper') doesn't seem to locate the object and I keep getting this error: "Possibly the object is null". Does anyone know a solution to help my method recognize ...

Having difficulty customizing the icon within the Alert component in Material UI for React by utilizing an external CSS file

I'm struggling to get my code to work properly. I'm currently using MUI to style my components with a separate CSS file. I'm attempting to style an Alert component, specifically focusing on the alert icon, but I'm having trouble getting ...

Cannot populate Kendo Menu with images due to dataSource imageUrl not recognizing the content

I have integrated Kendo controls into my application, specifically a Menu control with a datasource in my controller. Currently, I am passing the relative path of URL for imageUrl. However, as the application has grown, there are multiple calls being made ...

Retrieving data from array services in Angular using Typescript

I need help retrieving data from an array in my services using a get function. I've tried using the .filter and .find functions, but I'm struggling with the execution and haven't been able to retrieve the data successfully. I know this may b ...

Styling a modal popup using session storage in CSS

I recently created a modal popup using CSS by following a helpful tutorial that can be found at this link: Now, I am curious about how to store the value entered in a textbox as session data. I came across some code in another tutorial that demonstrated h ...

Utilizing Angular2 (Frontend) and Spring Boot (Backend) for Excel file uploading

As someone who is new to Angular 2, I am currently attempting to upload an Excel file from the Angular 2 frontend. My goal is to upload the Excel file from the Angular 2 frontend, send it to the Spring Boot backend for necessary modifications, and th ...

Tips for avoiding the display of the overall scrollbar while utilizing grid with an overflow:

In my react-redux application, I am utilizing the material ui Grid component for layout design. The structure of my code is as follows: <div> <Grid container direction="row" spacing={1}> <Grid item xs={3}> ...

Using Angular Material to create a data table with a fixed footer and paginator feature

I am facing a challenge with displaying the sum of rows data in the footer section of an Angular Material Table that has fixed footer and header, as well as a paginator. How can I calculate the sum of rows data to show in the footer? https://i.sstatic.net/ ...

Checking radios or checkboxes will always result in a null value when retrieving their form values

After following the instructions in the Angular 2 cookbook for dynamic forms, I encountered an issue with the radios and checkboxes. Despite checking them, they always return a null value. Interestingly, the touched properties of the radios and checkboxes ...

tap into adhesive, translucent screen

I designed a webpage with an iframe at the bottom that I set to be transparent so that overlapped elements are visible. However, I encountered an issue where the links beneath the iframe were not clickable unless I disabled pointer-events for the iframe. ...