Support Forums

Support Offline : Mon - Fri / 10am - 6pm (GMT +6)

Your Time: Our Time:

Margin/padding with 0 are ignored in frontend

Featured Lock Resolved Bug
I've noticed an issue (starting from version 3.1 to 3.1.2) whereby if you use 0 (and not 0px) in margin or padding or any parameter which has 'sp-pagebuilder-device-tabs' options, then the css is ignored in mobile and ipad if it has 0 (without the 'px').

How to reproduce the issue
1. Drop an addon in SP Page builder front end e.g. Feature Box
2. Navigate to Styles tab and set the margin as follows:
a) Desktop: -30px 0px 30px 0px;
b) tablet: 0 0 30px 0;
c) mobile: 0 0 20px 0;
3. Save.
4. If you toggle the view to mobile and then inspect the addon, you'll notice the margins are applied. e.g.
@media (max-width: 767px) {
#sppb-addon-1519677285754 {
margin-top: 0;
margin-right: 0;
margin-bottom: 30px;
margin-left: 0;
}
}
#sppb-addon-1519677285754 {
margin-top: -50px;
margin-right: 0px;
margin-bottom: 0px;
margin-left: 0px;
}

So in the code above the margin-top for mobile screens will be 0 instead of -50px.

Now close the Page Builder and view the addon in css in mobile view; The desktop shows ok but for the tablet and mobile, it doesn't consider the '0' and only shows the value that had 'px' values.

@media (max-width: 767px){
#sppb-addon-1519677285754 {
margin-bottom: 30px;
}
}
#sppb-addon-1519677285754 {
margin: -50px 0px 0px 0px;
}

So in this case the margin-top for mobile screens will be -50px instead of 0.

3 Answers

Sifat - Staff

More than a month ago #Permalink
Hi,
Thanks for your query. You must use ''px"as a suffix with the digits. It's designed to work on that way.

-Best Regards

joel_m

More than a month ago #Permalink
Hi Sifat,
If I 'must' use px, how come most of your addons come with '0' margin (without px)? Don't you think it's easier just to effect that the page builder can use either 0 or 0px since '0' is an accepted value for margins/padding?

Sifat - Staff

More than a month ago #Permalink
Hi,
Thanks for your reply. According to users feature requests we changed this feature to add 'px' as suffix.
That's why it works this way.

-Best Regards


There are no replies made for this post yet.
However, you are not allowed to reply to this post.

Leaderboard (30 days)

Paul Frankowski

Paul Frankowski

Total Accepted Answers: 208
Sifat

Sifat

Total Accepted Answers: 109
Toufiq

Toufiq

Total Accepted Answers: 88
Pavel

Pavel

Total Accepted Answers: 5
Rifat Wahid Alif

Rifat Wahid Alif

Total Accepted Answers: 3

100+

Templates

200,000+

Community Users

Newsletter

Don’t miss any updates of our new templates and extensions and all the astonishing offers we bring for you.
We never spam

Joomla! ® name is used under a limited license from Open Source Matters in the United States and other countries. JoomShaper.com is not affiliated with or endorsed by Open Source Matters or the Joomla! Project.

Connect Us