Reputation: 3327
I've got the following page as an example for a responsive layout: flexible Grid
Now i want my own project to do the same as the images on this page. As the screensize decreases, the elements should resize, too.
For the width of those elements, everything works just fine. But their height won't change. I wonder how the author of the example page achieved this, as he doesn't even use a single height-attribute on his images.
Here is my code:
HTML
<div id="wrapper">
<ol>
<li id="el-1" class="figure"><div class="element"><p class="heading">Lorem1</p></div></li>
<li id="el-2" class="figure"><div class="element"><p class="heading">Lorem2</p></div></li>
<li id="el-3" class="figure"><div class="element"><p class="heading">Lorem3</p></div></li>
<li id="el-4" class="figure"><div class="element"><p class="heading">Lorem4</p></div></li>
<li id="el-5" class="figure"><div class="element"><p class="heading">Lorem5</p></div></li>
<li id="el-logo" class="figure"><div class="background"><p>LoremIpsum<br>Lorem</p></div></li>
<li id="el-6" class="figure"><div class="element"><p class="heading">Lorem6</p></div></li>
<li id="el-7" class="figure"><div class="element"><p class="heading">Lorem7</p></div></li>
<li id="el-8" class="figure"><div class="element"><p class="heading">Lorem8</p></div></li>
<li id="el-9" class="figure"><div class="element"><p class="heading">Lorem9</p></div></li>
<li id="el-10" class="figure"><div class="element"><p class="heading">Lorem10</p></div></li>
</ol>
CSS
http://nopaste.info/d8a051e767.html
Upvotes: 0
Views: 853
Reputation: 4529
Its the
img {
max-width: 100%;
}
in ex-site-flexible.html line 63.
It makes the image as width as the containing A and images automatically scale correctly..
Other elements however do not, so you can only do this with images.
Upvotes: 0
Reputation: 142
The example page is using images while you're not. Then you can't use it as an example. In your case, if you don't set any height to your divs, they will grow to make their content fit. So, to make them resize together you can either use a table or use a javascript (check matching column for example)
Upvotes: 1