Fluid-Width Google Maps

Fluid-width Google maps

If you try to use style="width:100%;height:100%" on your map div, as you have done by giving 100% height, you get a map div that has zero height. That's because the div tries to be a percentage of the size of the <body>, but by default the has an indeterminate height.

There are ways to determine the height of the screen and use that number of pixels as the height of the map div, but a simple alternative is to change the <body> so that its height is 100% of the page. We can do this by applying style="height:100%" to both the <body> and the <html>. (We have to do it to both, otherwise the <body> tries to be 100% of the height of the document, and the default for that is an indeterminate height.)

Re-adjusting your css values should resolve your issue.

Full-Width Google Map And CSS

html, body {
width: 100%;
height: 100%;
}

.map-frame {
width: 100%;
height: 100%;
position: relative;
}

.map-content {
z-index: 10;
position: absolute;
top: 50px;
left: 50px;
width: 390px;
background-color: black;
color: #FFF;
}

http://jsfiddle.net/oswaldoacauan/tx67C/

Fluid Width Google Map

Demo: jsFiddle

Delete the <img/> tag from <div class="small-map"><img.../></div>

Add this to your css:

.small-map{
background: url(http://maps.google.com/maps/api/staticmap?center=CM13+2AA&zoom=14&size=250x250&maptype=roadmap&markers=color:ORANGE|label:A|CM13+2AA&sensor=false) center no-repeat;
height: 130px;
}

full size Google map doesn't fit to screen size

I just resolved it you need to change to:

height: 100vh;

and to make these following changes:

<style>
html, body {
height: 100%;
margin: 0;
padding: 0;
}
#map {
height: 100%;
}
</style>

Hope that help you as much it helped me.

css fluid layout with Google Map

Take a look at Yahoo YUI grids.

Yahoo YUI grids

The YUI CSS framework provides a very customizable number of grid layouts. Page widths vary from 750px, 950px, 974px and 100% & there are templates that provide both fixed left & right column widths - all guaranteed to work correctly across multiple browsers. Their choice of sizes is also related to common advertising dimensions, making it easier to fit ads if you so desire. All pages on Yahoo use these layouts..

You also have the option to incorporate 'reset' capabilities so that all browsers are set to a common layout with regard to fonts, padding, margin, etc.

It has made foundational web page development a much easier, less finicky process for me!

Google Map won't stretch the full width of the Column

You can add w-100 class to gives 100% width to any element.

<div class="row d-flex justify-content-center mt-5 mb-5 w-100">
<div class="col-12">
<iframe
src="https://www.google.com/maps/embed?pb=!1m18!1m12!1m3!1d3220.99444862719!2d-115.2891474483767!3d36.16668971070266!2m3!1f0!2f0!3f0!3m2!1i1024!2i768!4f13.1!3m3!1m2!1s0x80c8bf86523a6539%3A0xe2cd727e83aa610d!2s430%20S%20Rampart%20Blvd%20%23150%2C%20Las%20Vegas%2C%20NV%2089145!5e0!3m2!1sen!2sus!4v1634184552181!5m2!1sen!2sus"
style="border: 2px solid; width: 100%; height: 100%;"
allowfullscreen=""
loading="lazy"
></iframe>
</div>
</div>


Related Topics



Leave a reply



Submit