<h1>Inline Radio Buttons</h1>
<p>Semantic and Accessible</p>
<fieldset>
  <input id="item-1" class="radio-inline__input" type="radio" name="accessible-radio" value="item-1" checked="checked"/>
  <label class="radio-inline__label" for="item-1">
      Item 1
  </label>
  <input id="item-2" class="radio-inline__input" type="radio" name="accessible-radio" value="item-2"/>
  <label class="radio-inline__label" for="item-2">
      Item 2
  </label>
  <input id="item-3" class="radio-inline__input" type="radio" name="accessible-radio" value="item-3"/>
  <label class="radio-inline__label" for="item-3">
      Item 3
  </label>
</fieldset>
@import url(https://fonts.googleapis.com/css?family=Open+Sans);

body {
  font-family: 'Open Sans', helvetica, arial, sans-serif;
  max-width: 305px;
  margin: 3rem auto 0;
  line-height: 1.6;
  color: #444;
}

fieldset {
  border: none;
  padding: 0;
  margin: 0;
  text-align: center;
}

h1 {
  margin: 0;
  line-height: 1.2;
}

p {
  margin: 0 0 1.6rem;
  padding-bottom: 0.2rem;
  border-bottom: 1px solid #ddd;
}

.radio-inline__input {
    clip: rect(1px, 1px, 1px, 1px);
    position: absolute !important;
}

.radio-inline__label {
    display: inline-block;
    padding: 0.5rem 1rem;
    margin-right: 18px;
    border-radius: 3px;
    transition: all .2s;
}

.radio-inline__input:checked + .radio-inline__label {
    background: #B54A4A;
    color: #fff;
    text-shadow: 0 0 1px rgba(0,0,0,.7);
}

.radio-inline__input:focus + .radio-inline__label {
    outline-color: #4D90FE;
    outline-offset: -2px;
    outline-style: auto;
    outline-width: 5px;
}
/* 
Radio buttons are hard to style in polished ways while still retaining their accessibility features.

You can tell when these radio buttons have focus. Use the up/down/right/left keyboard arrows to navigate between them after. 

If you can't tell which one has focus or if you're focused on that element at all, then it's not accessible. In general, try not to rely on JS to make things accessible. Semantic HTML is pretty dang accessible already.
*/

External CSS

This Pen doesn't use any external CSS resources.

External JavaScript

This Pen doesn't use any external JavaScript resources.