-1

I am building a website on wix.com and I added a map with google maps. My code is as follow:

<iframe width="950" height="450" frameborder="0" style="border:0" src="https://www.google.com/maps/embed/v1/place?q=place_id:ChIJya9E14i2xUcRLWzbVXjmqMg&key=API_KEY&zoom=15" allowfullscreen></iframe>

On PC it looks good, but on mobile phones it looks like this: https://i.gyazo.com/7494bd5f9a82f7eccbacee355ed404b5.png

How do I make it so that it adjusts size on mobile phone so that people don't have to use scroll bars, but also so that they can click the route and save button?

Bob Arnson
  • 21,377
  • 2
  • 40
  • 47
J.K. Harthoorn
  • 218
  • 1
  • 3
  • 19

1 Answers1

1

Set the width to 100% so that it spans to the width of the phone without overflowing, then to handle it being too large on regular computers give it a max-width of 950.

<iframe width="100%" max-width="950" height="450" frameborder="0" style="border:0" src="https://www.google.com/maps/embed/v1/place?q=place_id:ChIJya9E14i2xUcRLWzbVXjmqMg&key=API_KEY&zoom=15" allowfullscreen></iframe>
Tom Haynes
  • 93
  • 5