Jump to content

How to remove top + bottom padding appearing on mobile only

Recommended Posts

Site URL: https://www.dmistry.co.uk/

Hi @tuanphan

On my homepage I've got a grid of images for which I've applied some custom css (which you wrote) to remove the padding and make it full width, it appears how I want it to on a desktop and tablet.. but on mobile, there's white space at the top and bottom of each image block.. is there a way to remove this please?

I've got the code below, applied to my homepage. 

/* homepage grid */
section[data-section-id="60e9829ec4c1a734c5d9c0cb"] {
  .content-wrapper { 
  padding-left: 0px!important;
  padding-right: 0px!important;
    max-width: 100%!important; }
    
 .image-block img {
    transition: all 0.5s ease;
 }
/* set background */
.image-block figcaption.image-card-wrapper {
    background: rgba(255,255,255,.95);
    transition: all .3s ease !important;
    max-height: 100%;
    opacity: 0;
}
.image-block figcaption.image-card-wrapper * {
    text-align: center;
    color: #3CBBC2 !important;
}
/* show on hover */
.image-block:hover figcaption.image-card-wrapper {
    opacity: 1;
    visibility: visible;
}
.sqs-block.image-block {
   padding: 0!important;
 }
}

 

Hoping you can help please! Thanks in advance!

Link to comment

when the width of the website becomes less than a certain width (ie on mobile) you get a slightly different set of style rules kick in, which is adding a 17px padding to the top and bottom of the rows of your layout. So you'd need to add CSS to override that padding.

@media screen and (max-width: 767px) {
  .sqs-layout .sqs-row .sqs-block:first-child,
  .sqs-layout .sqs-row .sqs-block:last-child {
      padding:0 !important;
  }
}

this would probably resolve your issue. (It's a site wide change, so if you only want it to hit this section then put section[data-section-id="60e9829ec4c1a734c5d9c0cb"] before each of the .sqs-layout lines). this should remove the padding between the images, but leave the padding above and below the first and last pictures which is as it is in the desktop site. 

if you wanted to remove those too, then add top and bottom padding inside your existing css for the sections content wrapper for data-section-id="60e9829ec4c1a734c5d9c0cb"

    padding-top: 0px !important;
    padding-bottom: 0px !important;

Hope that helps, let me know if it works

Dave Hart. Software/Technology Consultant living in London. buymeacoffee 

Link to comment

@mistd Do you want to fix this?

Site URL – https://www.dmistry.co.uk/

1. (All devices – Homepage) Scroll bar at the bottom of page.

https://www.dmistry.co.uk/

dmistry.co_.uk-01-min.png

2. (Tablet – About) Text break.

https://www.dmistry.co.uk/about

dmistry.co_.uk-02-min.png

Email me if you have need any help (free, of course.). Answer within 24 hours. 
Or send to forum message

Contact Customer Care - Learn CSS - Buy me a coffee (thank you!)

Link to comment

Hi @tuanphan, yes please, that would be very helpful! 

Sorry to add to that, I'm also having an issue changing the Page Title to 'Devki Mistry | Graphic Designer', as currently it's showing as 'www.dmistry.co.uk' on the tab... even though in my settings it's what i'd like it to be (screenshot attached).. not sure if you're able to help resolve this too please? 

Screen Shot 2021-07-28 at 10.26.30.png

Edited by mistd
Link to comment
21 hours ago, mistd said:

Hi @tuanphan, yes please, that would be very helpful! 

Sorry to add to that, I'm also having an issue changing the Page Title to 'Devki Mistry | Graphic Designer', as currently it's showing as 'www.dmistry.co.uk' on the tab... even though in my settings it's what i'd like it to be (screenshot attached).. not sure if you're able to help resolve this too please? 

Screen Shot 2021-07-28 at 10.26.30.png

Click SEO (under General) >> Check SEO Title

Email me if you have need any help (free, of course.). Answer within 24 hours. 
Or send to forum message

Contact Customer Care - Learn CSS - Buy me a coffee (thank you!)

Link to comment

Q1 + 2. Add to Design > Custom CSS

/* Text break tablet about us */
@media screen and (max-width:991px) and (min-width:768px) {
div#page-section-6076fdd00b17be708fd3d5cd .html-block {
    padding-left: 0;
    padding-right: 0;
}
}
html, body {overflow-x: hidden;}

 

Email me if you have need any help (free, of course.). Answer within 24 hours. 
Or send to forum message

Contact Customer Care - Learn CSS - Buy me a coffee (thank you!)

Link to comment
  • 1 year later...

Hello, I am trying to remove the padding on this section section[data-section-id="62ead031324621494f565555"] Only on mobile but the code doesn't seem to work:

@media screen and (max-width: 650px) {
  section[data-section-id="62ead031324621494f565555"] {
 padding:0 !important;}}

 

image.thumb.png.defddafb56c5a4f8b14bb283a23c4a79.png

 

Thank you in advance for your assistance. 

Link to comment
On 8/6/2022 at 4:45 AM, Mary_DG said:

Hello, I am trying to remove the padding on this section section[data-section-id="62ead031324621494f565555"] Only on mobile but the code doesn't seem to work:

@media screen and (max-width: 650px) {
  section[data-section-id="62ead031324621494f565555"] {
 padding:0 !important;}}

 

image.thumb.png.defddafb56c5a4f8b14bb283a23c4a79.png

 

Thank you in advance for your assistance. 

What is page url? We can check easier

Email me if you have need any help (free, of course.). Answer within 24 hours. 
Or send to forum message

Contact Customer Care - Learn CSS - Buy me a coffee (thank you!)

Link to comment
On 8/10/2022 at 11:19 PM, Mary_DG said:

Yes correct. 

Try adding to Design > Custom CSS

@media screen and (max-width: 767px) {
[data-section-id="62ead031324621494f565555"] .user-items-list-banner-slideshow .slide-content {
    margin-top: 0;
}}

 

Email me if you have need any help (free, of course.). Answer within 24 hours. 
Or send to forum message

Contact Customer Care - Learn CSS - Buy me a coffee (thank you!)

Link to comment
  • 2 weeks later...

Create an account or sign in to comment

You need to be a member in order to leave a comment

×
×
  • Create New...

Squarespace Webinars

Free online sessions where you’ll learn the basics and refine your Squarespace skills.

Hire a Designer

Stand out online with the help of an experienced designer or developer.