I am learning and I need to dynamically load several images, it can be 1 or 50, in the example I made a short loop with several floating divs to explain my problem. I need the divs to be aligned with the exact same space each other, the divs have fixed width and height (I will upload images inside) and the idea is that if I shrink the browser the spaces or horizontal margins between them will be recalculated, ie those that fit, are centered, and those that do not fit pass to a second line inside the container, aligned like the first. Maybe it is not the form and you should use jquery or javascript, you would need an example to start, study and adapt it.
The code for index.php:
<html>
<head>
<LINK REL="stylesheet" TYPE="text/css" HREF="css/estilo.css">
</head>
<body>
<div id="contenedor">
<?php
for ($i = 1; $i <= 10; $i++) {
?>
<div class="marcos">
<div class="fotos"></div>
</div>
<?php
}
?>
</div>
</body>
</html>
the style sheet:
* {
margin:0px;
padding:0px;
}
body {
text-align: center;
margin: 0 auto;
overflow: auto;
}
#contenedor {
max-width: 910px;
min-width: 240px;
text-align: center;
margin: 0 auto;
border: 1px solid blue;
overflow: hidden;
}
.marcos {
float:left;
width: 180px;
height: 220px;
border: 1px solid black;
overflow: hidden;
}
.fotos {
text-align: center;
margin: 9px 9px;
width: 160px;
height: 200px;
border: 1px solid orange;
}