Skip to content

Instantly share code, notes, and snippets.

@adamsilver
Last active August 29, 2015 14:26
Show Gist options
  • Save adamsilver/3673f34c49866c373dec to your computer and use it in GitHub Desktop.
Save adamsilver/3673f34c49866c373dec to your computer and use it in GitHub Desktop.
forms for the kids
<div class="groupControl">
<div class="indicator">Favourite things</div>
<fieldset>
<legend>Gender</legend>
<div class="control firstControl">
<input type="checkbox" class="checkbox" value="male" name="thing" id="thing">
<label for="thing">Thing</label>
</div>
<div class="control">
<input type="checkbox" class="checkbox" value="female" name="thing" id="thing1">
<label for="thing1">Thing 2</label>
</div>
<div class="control">
<input type="checkbox" class="checkbox" value="other" name="thing" id="thing2">
<label for="thing2">Thing 3</label>
</div>
</fieldset>
</div>
<div class="groupControl">
<div class="indicator">Gender</div>
<fieldset>
<legend>Gender</legend>
<div class="control firstControl">
<input type="radio" class="radio" value="male" name="gender" id="gender">
<label for="gender">Male</label>
</div>
<div class="control">
<input type="radio" class="radio" value="female" name="gender" id="gender1">
<label for="gender1">Female</label>
</div>
<div class="control">
<input type="radio" class="radio" value="other" name="gender" id="gender2">
<label for="gender2">Other WTF?</label>
</div>
</fieldset>
</div>
<!--
Notes:
1. The `id` of the first radio control MATCHES the `name` of the radio control
2. All radio controls within the same group have the same `name`
3. The `for` attribute for the label matches the id of the corresponding radio control
4. All subsequent radio controls have suffixed `id` attributes and again the label `for` attribute matches
-->
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment