Note that there are some explanatory texts on larger screens.

plurals
  1. POCSS DIV Swap without fixed height?
    primarykey
    data
    text
    <p>I am curious if it is possible to achieve a simple div swap using only css if the div does not have a fixed height. I have searched far and wide for an answer and have come up with little solid discussion on the matter.</p> <p>The idea is to have an expansive beer list divided into four separate divs and to display only one of them at a time. When clicking a corresponding anchor, the div displayed would switch while hiding the other three. The first div should display when the page loads. I have a little experience with this and have had success but only with fixed sizes as the foremost div would hide all other divs behind it.</p> <p>These particular divs will contain formatted tables and unordered-lists. I am not sure if that will have any affect, but thought it was worth mentioning just in case. The divs cannot have a fixed height because the number of items in each will vary. I haven't yet coded it as I am not sure if it is worth the time investment but the HTML would look something like this:</p> <pre><code>&lt;div id="secondaryNav"&gt; &lt;ul&gt; &lt;li&gt;Link to div1&lt;/li&gt; &lt;li&gt;Link to div2&lt;/li&gt; &lt;li&gt;Link to div3&lt;/li&gt; &lt;li&gt;Link to div4&lt;/li&gt; &lt;/ul&gt; &lt;/div&gt; &lt;div id="swappedContent"&gt; &lt;div id="1"&gt; &lt;table&gt; &lt;tr&gt;content&lt;/tr&gt; x 40-50 &lt;/table&gt; &lt;/div&gt; &lt;div id="2"&gt; &lt;table&gt; &lt;tr&gt;content&lt;/tr&gt; x 40-50 &lt;/table&gt; &lt;/div&gt; &lt;div id="3"&gt; &lt;table&gt; &lt;tr&gt;content&lt;/tr&gt; x 40-50 &lt;/table&gt; &lt;/div&gt; &lt;div id="4"&gt; &lt;table&gt; &lt;tr&gt;content&lt;/tr&gt; x 40-50 &lt;/table&gt; &lt;/div&gt; &lt;/div&gt;&lt;!--swappedContent--&gt; </code></pre> <p>I found an example that I am modeling this layout after (that uses javascript) but I am not sure of the appropriateness of linking to a site which I do not own here. If I should link to it for clarity, please let me know.</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