Note that there are some explanatory texts on larger screens.

plurals
  1. POHow do you mimic multi row horizontal scroll table behavior with CSS and Divs?
    primarykey
    data
    text
    <p>How do you mimic table behavior with CSS and Divs? Is it possible to mimic the table behavior below:</p> <ol> <li>Two rows with horizontal overflow and one horizontal overflow scrollbar</li> <li>No spacing between cells</li> </ol> <p>To see an example, <a href="http://jsfiddle.net/srakestraw/BcQbk/3/" rel="nofollow">http://jsfiddle.net/srakestraw/BcQbk/3/</a>. Here is the table code:</p> <pre><code>&lt;div style="width:500px; overflow:auto;"&gt; &lt;table width="1000px" cellspacing="0"&gt; &lt;tr&gt; &lt;td&gt;Row 1 - Cell 1&lt;/td&gt; &lt;td&gt;Row 1 - Cell 2&lt;/td&gt; &lt;td&gt;Row 1 - Cell 3&lt;/td&gt; &lt;td&gt;Row 1 - Cell 4&lt;/td&gt; &lt;td&gt;Row 1 - Cell 5&lt;/td&gt; &lt;td&gt;Row 1 - Cell 6&lt;/td&gt; &lt;/tr&gt; &lt;tr&gt; &lt;td&gt;Row 2 - Cell 1&lt;/td&gt; &lt;td&gt;Row 2 - Cell 2&lt;/td&gt; &lt;td&gt;Row 2 - Cell 3&lt;/td&gt; &lt;td&gt;Row 2 - Cell 4&lt;/td&gt; &lt;td&gt;Row 2 - Cell 5&lt;/td&gt; &lt;td&gt;Row 2 - Cell 6&lt;/td&gt; &lt;/tr&gt; &lt;/table&gt; &lt;/div&gt; </code></pre> <p>Style Sheet:</p> <pre><code> &lt;style&gt; td { width: 200px; border: 1px solid #ccc; } &lt;/style&gt; </code></pre> <p>I am close with the following code but cannot eliminate the spacing between cells or control the horizontal scroll for multiple rows.</p> <pre><code>&lt;style&gt; .slideContainer{ white-space: nowrap; overflow:auto; } .slide{ display: inline-block; width: 100px; white-space: normal; border: 1px solid #ccc; vertical-align:top; border: 1px solid #ccc; } &lt;/style&gt; &lt;div style="width:500px;"&gt; &lt;div class="slideContainer"&gt; &lt;div class="slide"&gt;Cell 1&lt;/div&gt; &lt;div class="slide"&gt;Cell 2&lt;/div&gt; &lt;div class="slide"&gt;Cell 3&lt;/div&gt; &lt;div class="slide"&gt;Cell 4&lt;/div&gt; &lt;div class="slide"&gt;Cell 5&lt;/div&gt; &lt;div class="slide"&gt;Cell 6&lt;/div&gt; &lt;/div&gt; &lt;/div&gt; </code></pre> <p>The end product will be more complicated with merged cells and I am leaning toward just using a table. My preference is to use divs to make it easier to implement front-end layout manipulation. </p> <p>It is not a true data table but is similar. I posted a mock-up at <a href="http://www.volunteeryourself.com/sch.htm" rel="nofollow">http://www.volunteeryourself.com/sch.htm</a>. </p>
    singulars
    1. This table or related slice is empty.
    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