- This topic has 11 replies, 3 voices, and was last updated 7 years ago by
Tom.
-
AuthorPosts
-
March 1, 2015 at 4:36 pm #81685
George
Is there any way to use different element margins when on mobile? My margins are large for reading on large screens, but they end up being way to big for mobile.
As usual, thank you!
March 1, 2015 at 11:49 pm #81768Tom
Lead DeveloperLead DeveloperAbsolutely – you’ll need to use some custom CSS targeted for mobile like this:
@media screen and (max-width: 768px) { /* mobile CSS in here */ }
March 2, 2015 at 10:29 am #81906George
Excellent! It worked great (after some experimentation looking for which elements I needed to target, and discovering there was extra spacing in the footer). Here’s my code for anybody else that might need it. Tom, I’m sure you have some feedback on it as well, just in case I targeted anything unnecessary. FYI, all of the feedback you have given me is easily worth the price I paid for GP premium π
@media screen and (max-width: 768px) { .separate-containers .inside-article, .separate-containers .comments-area, .separate-containers .page-header, .separate-containers .paging-navigation, .one-container .site-content, .separate-containers .widget.inner-padding { padding-left: 25px; padding-right: 25px; } .separate-containers .site.footer-widgets { padding-left: 0; } }
March 2, 2015 at 2:12 pm #81969Tom
Lead DeveloperLead DeveloperLooks good to me! Good job π
March 2, 2015 at 3:13 pm #81972George
Thank you. Hopefully the code will be useful for somebody else who is in the same boat as me.
September 12, 2016 at 1:16 am #225708Tully
Hi Tom
I am trying to do a similar thing – just want the right and left margins to be smaller than they are on mobile. I have tried the above CSS but nothing appears to change? It does work on one of my generate press websites, http://www.bendigodogtraining.com.au, but not on the other: http://www.campaspeworkingdogs.com/wordpress. Thanks Tom
September 12, 2016 at 8:29 am #225839Tom
Lead DeveloperLead DeveloperThe site where it’s not working is password protected so I can’t check.
September 13, 2016 at 11:44 pm #226264Tom
Lead DeveloperLead DeveloperAh, you’re using Sections, so your CSS would be:
@media (max-width: 768px) { .generate-sections-inside-container { padding-left: 25px; padding-right: 25px; } }
September 14, 2016 at 3:26 am #226311Tully
Hi Tom,
On its own that didn’t work, but when I inserted the .generate-sections-inside-container into the CSS in the above code from George it worked. As always, thanks for the amazing support for GeneratePress! Can I donate?
September 14, 2016 at 8:49 am #226391Tom
Lead DeveloperLead DeveloperNo problem!
That would be amazing! There’s an ongoing development link in my signature below π
Thanks!
September 14, 2016 at 4:19 pm #226489Tully
Just sent $100 your way. Thanks for all your help Tom and the great theme etc!
September 14, 2016 at 11:09 pm #226524Tom
Lead DeveloperLead DeveloperThat’s amazing, thank you so much! Incredibly generous π
-
AuthorPosts
- You must be logged in to reply to this topic.