question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Alert changes body padding style

See original GitHub issue

Currently, the library will add the padding-right: 15px; style to the body whenever it’s opened. This breaks my page layout. Is there a way to cancel or remove this?

Thanks.

Issue Analytics

  • State:closed
  • Created 6 years ago
  • Reactions:14
  • Comments:20 (7 by maintainers)

github_iconTop GitHub Comments

47reactions
bubjaviercommented, Nov 17, 2017

+1 but, for the meantime, this worked for me:

body {
  padding-right: 0 !important;
}
8reactions
odancommented, Jul 30, 2021

I had the same issue with Bootstrap 5. To fix it you need to change the swal2-shown CSS class and you need to disable scrollbarPadding.

.swal2-shown {
    overflow: unset !important;
    padding-right: 0px !important;
}
Swal.fire({
    scrollbarPadding: false,
    // optional
    heightAuto: false, 
    // ...
})
// ...
Read more comments on GitHub >

github_iconTop Results From Across the Web

Bootstrap Modals keep adding padding-right to body after ...
A pure CSS solution that keeps the bootstrap functionality as it should be. body:not(.modal-open){ padding-right: 0px !important; }.
Read more >
How To Adjust the Content, Padding, Border, and Margins of ...
In this tutorial, you will learn about the CSS Box Model , a model used to refer to the content, padding, border, and...
Read more >
How to change the style of alert box using CSS - GeeksforGeeks
To design the alert box we need jQuery then by using the only CSS we can do ... < style >. /* Body...
Read more >
Modal · Bootstrap v5.0
Included are the modal header, modal body (required for padding ), and modal footer (optional). We ask that you include modal headers with...
Read more >
HTML DOM Style paddingTop Property - W3Schools
The paddingTop property sets or returns the top padding of an element. ... object.style. ... Change the top padding of a <div> element...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found