Make iframe Responsive Google Map

As you may try to embed google map with iframe and the responsive looks bad cause thw width is static for this we need to fix it by addin div arround the iframe and call it googlemap  the html will be like this

<div class="googlemap">
<iframe src="!1m18!1m12!1m3!1d3390.682201836445!2d34.658961000000005!3d31.806410000000003!2m3!1f0!2f0!3f0!3m2!1i1024!2i768!4f13.1!3m3!1m2!1s0x1502a3146f6f2ff1%3A0x8748af783646c74e!2z15nXnNeT15kg15TXnteZ150g16nXnCDXnNeZ157Xldeo!5e0!3m2!1siw!2sil!4v1440163180181&language=iw" width="700" height="350" frameborder="0" style="border:0" allowfullscreen></iframe>


and the css will be

.googlemap {
        position: relative;
        padding-bottom: 75%; /* 4:3 ratio*/
        height: 0;
        overflow: hidden;

.googlemap iframe {
    position: absolute;
    top: 0;
    left: 0;
    width: 100% !important;
    height: 100% !important;


this should do the magic


Leave a Reply :)

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s