Note that there are some explanatory texts on larger screens.

plurals
  1. POUsing div as a viewport for floated elements inside of it
    primarykey
    data
    text
    <p>I'm trying to create a CSS/Angular only version of <a href="http://www.givainc.com/labs/ibutton_jquery_plugin.htm" rel="nofollow">http://www.givainc.com/labs/ibutton_jquery_plugin.htm</a></p> <p>My objective is to fully hide either the green or red piece by adjusting the left margin and only keeping the container wide enough for 1 to display. I can't seem to stop the red piece from wrapping when I adjust the width of the slideToggle container.</p> <p><a href="http://jsfiddle.net/vGBgB/2/" rel="nofollow">http://jsfiddle.net/vGBgB/2/</a></p> <pre><code>&lt;div class="slideToggle" ng-click="toggle" name="active" onlabel="Active" offlabel="Inactive" style="height: 34px; width: 115px;"&gt; &lt;input type="checkbox"&gt; &lt;span class="stOn" style="width: 50px;"&gt;Active&lt;/span&gt; &lt;span class="stHandle"&gt;| | |&lt;/span&gt; &lt;span class="stOff"&gt;Inactive&lt;/span&gt; &lt;/div&gt; </code></pre> <p>Here's my CSS (only posting because SO requires it)</p> <pre><code>.slideToggle { cursor: pointer; overflow: hidden; white-space: nowrap; } .slideToggle &gt; input[type=checkbox] { display: none; } .slideToggle &gt; .stOff, .slideToggle &gt; .stOn { float: left; height: 22px; padding: 4px 10px 0; color: #fff; text-align: center; white-space: nowrap; font-size: 11px; line-height: 18px; font-weight: bold; text-transform: uppercase; text-shadow: 0 1px #808080; } .stHandle {; float: left; min-width: 25px; background: linear-gradient(to bottom, #fdfdfd 0%,#ebebeb 99%); padding: 2px 1px 2px 0; border: 1px solid #8f8f8f; border-radius: 3px; color: #c6c6c6; letter-spacing: -1px; text-align: center; } .slideToggle &gt; .stOn { float: left; margin-right: -1px; background: linear-gradient(to bottom, #8ab056 0%,#a2c46b 100%); border: 1px solid #88a75c; border-right: none; border-top-left-radius: 3px; border-bottom-left-radius: 3px; } .slideToggle &gt; .stOff { float: left; margin-left: -1px; background: linear-gradient(to bottom, #d4786a 0%,#e39080 100%); border: 1px solid #bd6e61; border-left: none; border-top-right-radius: 3px; border-bottom-right-radius: 3px; } .slideToggle &gt; .stOff::after { content: ""; clear: both; } </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.
 

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