Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>It can be done with CSS and without the need of a large framework. I have done this with checkboxes and radio buttons.</p> <p><strong>This works without adding new HTML, or bringing in any JS libraries.</strong> => <a href="http://jsfiddle.net/YB8UW/8/" rel="noreferrer">jsFiddle</a></p> <p><strong>THE NEW ORDER OF THE HTML</strong></p> <pre><code>&lt;ul class="donate-now"&gt; &lt;li&gt; &lt;input type="radio" id="a25" name="amount" /&gt; &lt;label for="a25"&gt;$25&lt;/label&gt; &lt;/li&gt; &lt;li&gt; &lt;input type="radio" id="a50" name="amount" /&gt; &lt;label for="a50"&gt;$50&lt;/label&gt; &lt;/li&gt; &lt;li&gt; &lt;input type="radio" id="a75" name="amount" checked="checked" /&gt; &lt;label for="a75"&gt;$75&lt;/label&gt; &lt;/li&gt; &lt;li&gt; &lt;input type="radio" id="a100" name="amount" /&gt; &lt;label for="a100"&gt;$100&lt;/label&gt; &lt;/li&gt; &lt;li&gt; &lt;input type="radio" id="other" name="amount" /&gt; &lt;label for="other"&gt;other:&lt;/label&gt; &lt;/li&gt; &lt;li&gt; &lt;input type="text" id="otherAmount" name="numAmount" /&gt; &lt;/li&gt; &lt;/ul&gt; </code></pre> <p><strong>THE CSS</strong></p> <pre><code>.donate-now { list-style-type:none; margin:25px 0 0 0; padding:0; } .donate-now li { float:left; margin:0 5px 0 0; width:100px; height:40px; position:relative; } .donate-now label, .donate-now input { display:block; position:absolute; top:0; left:0; right:0; bottom:0; } .donate-now input[type="radio"] { opacity:0.01; z-index:100; } .donate-now input[type="radio"]:checked + label, .Checked + label { background:yellow; } .donate-now label { padding:5px; border:1px solid #CCC; cursor:pointer; z-index:90; } .donate-now label:hover { background:#DDD; } </code></pre> <p>This is the ten minute hacky version, you can clean it up even further, but it shows a good example of how simple it is.</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.
    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