Topic: Update added padding to <main> element when using sidenavbar

waynefulcher pro asked 3 years ago

I recently updated to the latest MBD code and now I see that when my browser window is wide enough for the side nav bar to show something in the code is now adding "padding-left: 240px;" to the styles of the element. This is now messing up the alignment of everything but I cant figure out how to override that in the js.

Thanks Wayne

Krzysztof Wilk staff answered 3 years ago


There are two ways to overwrite it.

CSS: You can just add selector-of-an-element { padding-left: 0 !important }

JS: If you want to do it by JS you can use .css() jQuery method. Sample code should look like this: $('selector-of-an-element').css('padding-left', '0')

Of course, you have to swap selector-of-an-element with .class / #id of an element you want to use.

It's hard to help without a working example, so if solutions above didn't help, could you make a snippet with your problem in our online MDB Editor here - then paste it below? It'll be very helpful :)

Best regards

Please insert min. 20 characters.


Hire our experts to build a dedicated project. We'll analyze your business requirements, for free.



Specification of the issue

  • ForumUser: Pro
  • Premium support: No
  • Technology: MDB jQuery
  • MDB Version: 4.19.1
  • Device: pc
  • Browser: CHROME
  • OS: WINDOWS 10
  • Provided sample code: No
  • Provided link: No