Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>This is what I usually do with my radio buttons and checkboxes. It allows the associated text to be clickable in most browsers without having to do any work, which makes the form a little easier to use. The CSS <code>cursor</code> change helps to alert the user to this feature.</p> <p>CSS</p> <pre><code>label { cursor: pointer; } </code></pre> <p>HTML</p> <pre><code>&lt;label&gt;&lt;input type="radio" name="option" value="yes"&gt; Yes&lt;/label&gt; &lt;label&gt;&lt;input type="radio" name="option" value="no"&gt; No&lt;/label&gt; &lt;label&gt;&lt;input type="radio" name="option" value="maybe"&gt; Maybe&lt;/label&gt; </code></pre> <p>Alternatively, use a <code>fieldset</code> legend for cars and a <code>ul</code> for the list of radio buttons:</p> <pre><code>&lt;fieldset&gt; &lt;legend&gt;Cars&lt;/legend&gt; &lt;ul class="radio-list"&gt; &lt;li&gt;&lt;label&gt;&lt;input type="radio" name="option" value="yes"&gt; Yes&lt;/label&gt;&lt;/li&gt; &lt;li&gt;&lt;label&gt;&lt;input type="radio" name="option" value="no"&gt; No&lt;/label&gt;&lt;/li&gt; &lt;li&gt;&lt;label&gt;&lt;input type="radio" name="option" value="maybe"&gt; Maybe&lt;/label&gt;&lt;/li&gt; &lt;/ul&gt; &lt;fieldset&gt; </code></pre> <p>CSS</p> <pre><code>.radio-list li { list-style: none; } </code></pre> <p>Stylizing a <code>fieldset</code>/<code>legend</code> to be consistent across browsers isn't too difficult; however, it does require one IE conditional if you want a border around the <code>legend</code>. The only extra HTML that is necessary is a wrapper <code>span</code> within the <code>legend</code>.</p> <p>CSS</p> <pre><code>&lt;style&gt; fieldset { position: relative; border: 1px solid #000; background: #f8f8f8; padding: 1.6em 10px 0px; margin: 0; } legend { position: absolute; font-weight: bold; font-size: 1.2em; } legend span { position: absolute; top: -1.1em; white-space: nowrap; } /* This isn't necessary, just here for list aesthetics */ ul, li { margin: 0; padding: 0; list-style-type: none; } &lt;/style&gt; &lt;!--[if IE]&gt; &lt;style&gt; legend { border-bottom: 1px solid #000; } &lt;/style&gt; &lt;![endif]--&gt; </code></pre> <p>HTML</p> <pre><code>&lt;fieldset&gt; &lt;legend&gt;&lt;span&gt;Did you enjoy your SO experience?&lt;/span&gt;&lt;/legend&gt; &lt;form&gt; &lt;ul&gt; &lt;li&gt;&lt;label&gt;&lt;input type="radio" name="option" value="yes"&gt; Yes&lt;/label&gt;&lt;/li&gt; &lt;li&gt;&lt;label&gt;&lt;input type="radio" name="option" value="no"&gt; No&lt;/label&gt;&lt;/li&gt; &lt;li&gt;&lt;label&gt;&lt;input type="radio" name="option" value="maybe"&gt; Maybe&lt;/label&gt;&lt;/li&gt; &lt;/ul&gt; &lt;/form&gt; &lt;/fieldset&gt; </code></pre> <p>That's about as simple as I can get it. <a href="http://jsbin.com/uhuzi/3" rel="nofollow noreferrer">Live example</a></p>
    singulars
    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. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
    3. VO
      singulars
      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