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; } Link to comment https://forums.phpfreaks.com/topic/81344-solved-square-divs/ 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. Link to comment https://forums.phpfreaks.com/topic/81344-solved-square-divs/#findComment-413080 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? Link to comment https://forums.phpfreaks.com/topic/81344-solved-square-divs/#findComment-413743 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> Link to comment https://forums.phpfreaks.com/topic/81344-solved-square-divs/#findComment-413790 Share on other sites More sharing options...
scottybwoy Posted December 14, 2007 Author Share Posted December 14, 2007 Great thanks for that Link to comment https://forums.phpfreaks.com/topic/81344-solved-square-divs/#findComment-414722 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.