Note that there are some explanatory texts on larger screens.

plurals
  1. POSet all div heights to tallest in row with wrapping parent
    primarykey
    data
    text
    <p><a href="http://jsfiddle.net/JNQBj/4/" rel="nofollow">http://jsfiddle.net/JNQBj/4/</a></p> <p><strong>HTML</strong></p> <pre><code>&lt;div class="rackRowWrapper"&gt; &lt;div class="rackWrapper"&gt;&lt;div class="smallRack"&gt;&lt;/div&gt;&lt;/div&gt; &lt;div class="rackWrapper"&gt;&lt;div class="mediumRack"&gt;&lt;/div&gt;&lt;/div&gt; &lt;div class="rackWrapper"&gt;&lt;div class="smallRack"&gt;&lt;/div&gt;&lt;/div&gt; &lt;div class="rackWrapper"&gt;&lt;div class="largeRack"&gt;&lt;/div&gt;&lt;/div&gt; &lt;div class="rackWrapper"&gt;&lt;div class="smallRack"&gt;&lt;/div&gt;&lt;/div&gt; &lt;div class="rackWrapper"&gt;&lt;div class="mediumRack"&gt;&lt;/div&gt;&lt;/div&gt; &lt;div class="rackWrapper"&gt;&lt;div class="largeRack"&gt;&lt;/div&gt;&lt;/div&gt; &lt;div class="rackWrapper"&gt;&lt;div class="smallRack"&gt;&lt;/div&gt;&lt;/div&gt; &lt;/div&gt; </code></pre> <p><strong>CSS</strong></p> <pre class="lang-css prettyprint-override"><code>.rackRowWrapper { font-size: 0; } .rackRowWrapper &gt; * { display: inline-block; margin: 0; padding: 0; border: 0; background-image: -ms-linear-gradient(top, #FFFFFF 0%, #BABABA 100%); background-image: -moz-linear-gradient(top, #FFFFFF 0%, #BABABA 100%); background-image: -o-linear-gradient(top, #FFFFFF 0%, #BABABA 100%); background-image: -webkit-gradient(linear, left top, left bottom, color-stop(0, #FFFFFF), color-stop(1, #BABABA)); background-image: -webkit-linear-gradient(top, #FFFFFF 0%, #BABABA 100%); background-image: linear-gradient(to bottom, #FFFFFF 0%, #BABABA 100%); } .smallRack { height: 200px; width: 100px; } .mediumRack { height: 100px; width: 100px; } .largeRack { height: 300px; width: 100px; } </code></pre> <p>I've got a bunch of various-sized rectangles. Whenever a rectangle doesn't fit on the current row, display: inline-block causes them to be wrapped and then rendered on the row below.</p> <p>I am trying to provide a visual effect where each 'wrapped row' looks distinct. I do not wish to manually create row elements in which to nest my rectangles. I have no (easy) means of calculating how many rectangles should be rendered for a given area and I wish to leave that calculation to the browser.</p> <p>As such, it gets a bit tricky. If I apply the gradient to rackRowWrapper then the <strong>entire</strong> contents has one gradient. This does not give the illusion of distinct rows.</p> <p>So, I thought I'd wrap each rectangle in a wrapped, rackWrapper, and set the gradient at this level. Then, whenever a rackWrapper wraps down to the next level... a visually distinct, new row appears. You can sort of see that in the jsfiddle.</p> <p>However, because my elements are inline-block, rackWrapper does not grow to fit the row. This causes my gradient to be malformed.</p> <p>Short of appropriately calculating my gradient for each rectangle such that the gradient aligns appropriately between each -- do I have any options here? Is there a good way to achieve this visual effect?</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload