[OpenLayers-Users] map div height 90% not working

Christopher Schmidt crschmidt at metacarta.com
Tue Sep 15 14:41:50 EDT 2009


On Tue, Sep 15, 2009 at 12:33:05PM -0500, P Kishor wrote:
> I have the following page structure
> 
> body { width: 100%; height: 100%; margin: 0; }
> #main { width: 100%; height: 100%; }
> #map { width: 100%; height: 90%; }
> 
> <body>
> <div id="main">
>   <div id="map"></div>
>   <div id="coords"></div>
> </div>
> </body>
> 
> 
> Yet, my map div height collapses to nothing... a pixel maybe, and the
> map vanishes. Of course, if I change either #main { height: 700px; }
> or #map { 650px; }, the map displays fine. I am testing on Firefox. Is
> there some trick to making the map div expand to 90% of the height of
> the browser window?

"Don't use XHTML."

Your body is '100%'... of 0 pixels, because you haven't set up the height
of your "HTML" tag, which defaults to 0 pixels in XHTML documents. put
"html, " before your "body {".

Regards,
-- 
Christopher Schmidt
MetaCarta



More information about the Users mailing list