Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p><strong>A JQuery approach with no tables</strong></p> <p>You can achieve this with JQuery (or plain javascript) which I am assuming you are using to show/hide the elements anyway.</p> <pre><code>$("#ButtonOne").click(function () { $(".one").toggle(); if($(".one").is(":visible")){ $(".two").css("width", "50%"); } else{ $(".two").css("width", "100%"); } }); $("#ButtonTwo").click(function () { $(".two").toggle(); if($(".two").is(":visible")){ $(".one").css("width", "50%"); } else{ $(".one").css("width", "100%"); } }); </code></pre> <p>The above JQuery assumes two buttons for toggling the visibility of the elements.</p> <p><a href="http://jsfiddle.net/RKR88/1/" rel="nofollow">Here is an example</a></p> <p>With the example, it should be noted that using 50% width with <code>inline-block</code> requires zero whitespace in between the elements. Hence the <code>&lt;/div&gt;&lt;div...</code> requirement.</p> <p>You will need some <code>vertical-align:top;</code> aswell to ensure the DIV elements stay in line.</p> <hr> <p>Incase the link ever breaks, here is the accompanying HTML...</p> <pre><code>&lt;div class="main"&gt; &lt;div class="one"&gt;this is one&lt;/div&gt;&lt;div class="two"&gt;this is two&lt;/div&gt; &lt;/div&gt; &lt;input type="button" id="ButtonOne" value="Toggle one" /&gt; &lt;input type="button" id="ButtonTwo" value="Toggle two" /&gt; </code></pre> <p>...and CSS...</p> <pre><code>body{ margin:0; padding:0; } div{ margin:0; padding:0; } .one { background-color:red; height:100px; width:50%; display:inline-block; } .two { background-color:blue; height:100px; width:50%; display:inline-block; } </code></pre>
    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.
    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