Nebula
Nebula

Reputation: 691

Embedding Google map inside div tags inside more div tags

I'm having problems embedding a Google map inside multiple div tags inside a webpage.

If I declare the map div () outside the div tags(i.e. in the body only) it works. But it is either right at the top or bottom of my page. If I declare it inside the div where I want it, it doesn't show. Almost as though it is underneath the tag contents.

I would greatly appreciate any help.

Upvotes: 2

Views: 4047

Answers (1)

Nebula
Nebula

Reputation: 691

I solved the problem.

The original declaration - div id="map_canvas" style="width:100%; height:100%" - doesn't work Because of the style css format of the previous div tags it returns the height as 0 and 100% of 0 is still 0. So Explicitly setting the height attribute to 100px works.

Solution: div id="map_canvas" style="width:100px; height:100px"

Happy

Upvotes: 6

Related Questions