Fixed Legend in Google Maps Mashup

前端 未结 2 2089
遥遥无期
遥遥无期 2021-02-06 02:32

I have a page with a Google Maps mashup that has pushpins that are color-coded by day (Monday, Tuesday, etc.) The IFrame containing the map is dynamically sized, so it gets resi

2条回答
  •  爱一瞬间的悲伤
    2021-02-06 02:48

    I would use HTML like the following:

    ... marker descriptions in here ...

    You can then style this to keep the legend in the bottom right:

    div#wrapper { position: relative; }
    div#legend { position: absolute; bottom: 0px; right: 0px; }
    

    position: relative will cause any contained elements to be positioned relative to the #wrapper container, and position: absolute will cause the #legend div to be "pulled" out of the flow and sit above the map, keeping it's bottom right edge at the bottom of the #wrapper and stretching as required to contain the marker descriptions.

提交回复
热议问题