scottybwoy Posted December 12, 2007 Share Posted December 12, 2007 Ok if I have a div that has a variable width of 33%, can I make it so that the height of the div is what ever that size is? Like { width: 33%; height: width; } Quote Link to comment Share on other sites More sharing options...
phpQuestioner Posted December 12, 2007 Share Posted December 12, 2007 you could do it with javascript similar to the example you provided. Quote Link to comment Share on other sites More sharing options...
scottybwoy Posted December 13, 2007 Author Share Posted December 13, 2007 Thanks, although I'm not too hot on js, how would I go about that? Quote Link to comment Share on other sites More sharing options...
phpQuestioner Posted December 13, 2007 Share Posted December 13, 2007 <script language="javascript"> var size="33%"; window.onload=function() { document.getElementById("myDIV").style.width = size; document.getElementById("myDIV").style.height = size; } </script> <div id="myDIV" style="border:solid 1px black"></div> Quote Link to comment Share on other sites More sharing options...
scottybwoy Posted December 14, 2007 Author Share Posted December 14, 2007 Great thanks for that 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.