So my question is rather simple, tho I've been spending days trying to find a solution.
The code below shows the result I get with values in pixel :
html part :
<div id="wrapper">
<ul>
<li></li>
<li></li>
<li></li>
<li></li>
<li></li>
<li></li>
<li></li>
<li></li>
<li></li>
</ul>
</div>
css part:
#wrapper { margin:30px auto; width:768px; }
#wrapper ul { width:771px; list-style:none; list-style-type:none; padding:0; margin:0; overflow:hidden; }
#wrapper li { width:254px; height:254px; margin-right:3px; margin-bottom:3px; background:#ebebeb; float:left; }
Here's a link that sums up the above: http://jsfiddle.net/7aXLu/
I am trying to make the whole thing "fluid", so that when being resized, the structure remains the same.
So here's the catch: in order NOT to use a bazillion of media queries, I'd like to express my values in percentage, knowing that :
- the box width must be equal to 1/3 of the wrapper
- the box height must be equal to its width (solved: Responsively change div size keeping aspect ratio)
- right margins should be equal to 3px
- bottom margins MUST be equal to right margin
- no extra margin, or padding (nor ugly cheats)
I am trying to stick with a 100% CSS solution, but I guess I might be forced to use Javascript.
I am open to any suggestion, even if you don't have an exact clue.
Thanks in advance.