Jump to content

Width and Height setting will not work using percantages


UG1234

Recommended Posts

Hi,

 

I am using a simple javascript mapping application called OpenSpace and i wish to set the width and height of my map using percantages instead of pixels.

 

Example of my code is below (which works fine)and i have bolded the width and height section.

 

If i replace with width: 90%; height: 90%; the map is squashed up at the top of the page.

 

does anyone know where i am going wrong?

 

 

 

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"

"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">

 

 

<html xmlns="http://www.w3.org/1999/xhtml">

    <head>

        <title>Basic Map</title>

        <script type="text/javascript" src="http://127.0.0.1/openspace.js">

        </script>

        <script type="text/javascript">

            <!--

           

            var osMap;

           

            function init()

            {             

                osMap = new OpenSpace.Map('map');

               

                osMap.setCenter(new OpenSpace.MapPoint(438760, 114760), 6);

            }

 

 

            // -->

        </script>

    </head>

    <body onload="init();">

        <div id="map" style="width: 800px; height: 600px; border: 1px solid black;">

        </div>

    </body>

</html>

 

 

Thanks for any help in adance

 

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.