UG1234 Posted April 12, 2010 Share Posted April 12, 2010 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 Quote Link to comment Share on other sites More sharing options...
Ken2k7 Posted April 12, 2010 Share Posted April 12, 2010 90% of what? The entire page? 90% of nothing is nothing. Try giving body a height and width attribute. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.