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

 

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.