Jump to content

Centering a google map

Recommended Posts

  • Replies 7
  • Views 3.4k
  • Created
  • Last Reply
2 minutes ago, read1 said:

Site URL: https://www.betterbasics.org/book-nook

I used custom code to upload a google map to a webpage.  How do I center the map? It is shifting to the left margin.

Thank you,

Please add this to Design->Custom Css

#block-yui_3_17_2_1_1604956736194_7123 iframe {
      margin: 0 auto;
      display: block;
      width: 100%;
}

image.thumb.png.00f23277da7cc8d45b4946b18de5818b.png

BeyondSpace - Squarespace Website Developer

🖼️ Lightbox Studio (Enable Pinch/Zoom on lightbox)
🗓️ Delivery Date Picker (Squarespace Date picker form field)
💫 Gallery block 7.1 workaround
🥳 Sparkplugin Customisations Browsers (Browse +100 Spark plugin customisations)
🥳 Elfsight Template Browsers (Browse +1000 Elfsight widget Templates)

If you find my answer useful, let's leave a like or upvote so others with the same issue can find their solution. Thank you!

 

Link to comment
  • 4 months later...
On 11/13/2020 at 3:58 PM, bangank36 said:

Please add this to Design->Custom Css


#block-yui_3_17_2_1_1604956736194_7123 iframe {
      margin: 0 auto;
      display: block;
      width: 100%;
}

image.thumb.png.00f23277da7cc8d45b4946b18de5818b.png

bangank36 thank very much for this. I have searching for the css for this for 2 days and this works perfectly.

Link to comment
10 minutes ago, IvanOB said:

bangank36 thank very much for this. I have searching for the css for this for 2 days and this works perfectly.

Can i also check if there is a way to do this with one entry for all google maps rather than individually using their block ids? I can't work out the specific embed-block identifier to use.

Link to comment
1 hour ago, IvanOB said:

Can i also check if there is a way to do this with one entry for all google maps rather than individually using their block ids? I can't work out the specific embed-block identifier to use.

try

.sqs-block-content iframe {
      margin: 0 auto;
      display: block;
      width: 100%;
}

and remove or resize space to col-1

image.thumb.png.977e7c814a8e007a5919a1b949e97c66.png

BeyondSpace - Squarespace Website Developer

🖼️ Lightbox Studio (Enable Pinch/Zoom on lightbox)
🗓️ Delivery Date Picker (Squarespace Date picker form field)
💫 Gallery block 7.1 workaround
🥳 Sparkplugin Customisations Browsers (Browse +100 Spark plugin customisations)
🥳 Elfsight Template Browsers (Browse +1000 Elfsight widget Templates)

If you find my answer useful, let's leave a like or upvote so others with the same issue can find their solution. Thank you!

 

Link to comment

@IvanOB Hi. I see same problem on Tablet.

You can use this CSS for tablet

/* center map */
@media screen and (max-width:991px) and (min-width:768px) {
div#block-yui_3_17_2_1_1605281700671_15297+.row .span-10 {
    width: 100%;
}
div#block-yui_3_17_2_1_1604956736194_7123 {
    text-align: center;
}
}

image.thumb.png.7605ef8d22af1ba2de81bee313aa8d77.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
On 3/30/2021 at 8:56 AM, tuanphan said:

@IvanOB Hi. I see same problem on Tablet.

You can use this CSS for tablet


/* center map */
@media screen and (max-width:991px) and (min-width:768px) {
div#block-yui_3_17_2_1_1605281700671_15297+.row .span-10 {
    width: 100%;
}
div#block-yui_3_17_2_1_1604956736194_7123 {
    text-align: center;
}
}

image.thumb.png.7605ef8d22af1ba2de81bee313aa8d77.png

Thanks @tuanphan 

I used @bangank36 code for the desktop and some tips from another youtube video to tailor the nobile view as below, which works fine so far in my testing. Just finishing off my first blog so will get a couple of friends to test out before publishing to make sure the page works on different devices

/* center blog google embedded map */
.sqs-block-content iframe {
      margin: 0 auto;
      display: block;
      width: 100%;
}

/*  make blog google map size smaller on mobile screen*/
@media only screen and (max-width: 767px) {
.sqs-block-content iframe {
      margin: 0 auto;
      display: block;
      width: 80%;
  height: 50vh!important;
}
}

Link to comment

Archived

This topic is now archived and is closed to further replies.

×
×
  • 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.