1

I'm using wpbakery wordpress plugin. I added in design options padding and generated css code looks like:

.vc_custom_1541499756394 {
padding-top: 30px !important;
padding-right: 250px !important;
padding-left: 250px !important;
}

I need to remove padding on smaller screen sizes. My question is, what is best practice to do that? Simple media query like this or there is better way?

@media only screen and (max-width: 720px) {
  .vc_custom_1541499756394 {
    padding-top: 0px !important;
    padding-right: 0px !important;
    padding-left: 0px !important;
  }
}
user3590094
  • 119
  • 1
  • 2
  • 11

1 Answers1

1

A more flexible approach would be to remove all of the styles you've added to the VC meta box and assign a class to it, pushing the required styles that way. Doing so will enable you to be specific for viewports and enable you to reuse the style across your site.

Set your Design Options like this:

enter image description here

And assign a style here:

enter image description here

Then add the required styles to the class.

Hope that helps :)

Ash Loudon
  • 102
  • 1
  • 11
  • I'm not sure it's 'bad practice' but you can make life easier for yourself by using classes. – Ash Loudon Nov 07 '18 at 12:27
  • Yes, but i didn't find way to remove padding on mobile screens when is added on Design options...vc-custom class can't be overided... or i'm wrong? – user3590094 Nov 07 '18 at 12:51
  • Remove all the padding in the design options and include it as a declaration on the class you specify for that element. – Ash Loudon Nov 07 '18 at 13:23