12% off of LTD using this coupon: TWELVEPERCENTOFF. Promo ends on 2 Dec midnight UTC.
Published on May 26, 2021

Responsive Google Map Embed in Oxygen

Sridhar Katakam

This tutorial provides the steps to embed responsive maps in Oxygen using Google’s Maps Embed API.

Step 1

Visit the Google maps embed API quickstart page.

Follow the steps listed there to obtain an API key.

Step 2

Enter your desired address or the search term or any other option available under “I want to…” and generate the iframe code.

Paste your API key and press Done to get the iframe code similar to:

<iframe width="600" height="450" style="border:0" loading="lazy" allowfullscreen src="https://www.google.com/maps/embed/v1/place?q=place_id:ChIJcw5BAI63t4kRj5qZY1MSyAo&key=xxxxxxxxxxxxxxxxxxxxx_xxxxxxxxxxxxxxxxx"></iframe>

Step 3

Add a Code Block component in Oxygen builder.

Set its width to 100%.

If you do not want the map to take up the full width of the container, set the max-width to something like 500px.

Paste the iframe code in the PHP & HTML section but without the

width="600" height="450" style="border:0"


Also, wrap the code between

<div class="iframe-container">




<div class="iframe-container"><iframe loading="lazy" allowfullscreen src="https://www.google.com/maps/embed/v1/place?q=place_id:ChIJcw5BAI63t4kRj5qZY1MSyAo&key=xxxxxxxxxxxxxxxxxxxxx_xxxxxxxxxxxxxxxxx"></iframe></div>

Step 4

At Manage > Stylesheets, add the following CSS:

/* Responsive iframes */

:root {
	--aspect-ratio: 16/9;

.iframe-container {
	position: relative;
	width: 100%;
	margin-bottom: 40px;

.iframe-container::before {
	content: "";
	display: block;
	padding-bottom: calc(100% / (var(--aspect-ratio)));

.iframe-container iframe {
	position: absolute;
	top: 0;
	left: 0;
	width: 100%;
	height: 100%;
	border: 0;