Link to home
Start Free TrialLog in
Avatar of Ryan Bayne
Ryan BayneFlag for United Kingdom of Great Britain and Northern Ireland

asked on

Div grid loses shape when zooming out in firefox

Hey

My grid is losing its form when I zoom in and out in firefox. Its basically a div container of 1000x1000px with 100 divs inside.

When I zoom out to a certain point it ends up 9 boxes wide and 12 down the last row only having 1 box on it.
I've set padding and margin to 0 and have no idea how to prevent this. No working sample online right now but this code below is ready to test needs no external files.

this is an interesting one for me so thanks for any help

<?php
	/* Loop 10 times to create a 100 square grid within a fixed area */
	//AD = 100 x 100
	
	$gridwidth = 10;
	$gridheight = 10;
	
	$adwidth = 100;
	$adheight = 100;
	
	$divwidth = $gridwidth * $adwidth + 20;
	$divheight = $gridheight * $adheight + 20;
	
	$adnumber = $gridwidth * $gridheight; //gets number of blocks required
?>
 
<!-- HTML IS BUILT FROM HERE ON -->
<div style="width:<?php echo $divwidth;?>px; height:<?php echo $divheight;?>px; border:solid 0px #000000; padding:0; margin:0;">
	<!-- GRID STARTS HERE -->
	<?php
		//       initial value   		
		for ( $counter = 1; $counter <= $adnumber; $counter += 1) 
		{	?>
			<!-- 1 BLOCK STARTS HERE -->
			<div style="width:<?php echo $adwidth;?>px; height:<?php echo $adheight;?>px; float:left; border:solid 1px #000000; padding:0; margin:0;">
				TEST
			</div>
			<!-- 1 BLACK ENDS HERE -->
			<?php  
		}
 
	?>
	<!-- GRID ENDS HERE -->
</div>

Open in new window

ASKER CERTIFIED SOLUTION
Avatar of Pantalaim0n
Pantalaim0n
Flag of Netherlands image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of Ryan Bayne

ASKER

Thats great and taught me a couple of things cheers