Skip to content

Instantly share code, notes, and snippets.

@anythinggraphic
Last active September 16, 2017 17:57
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save anythinggraphic/72cdab975ce9e3662b8bb30b5eb3f003 to your computer and use it in GitHub Desktop.
Save anythinggraphic/72cdab975ce9e3662b8bb30b5eb3f003 to your computer and use it in GitHub Desktop.
/*
Original link http://www.templatemonster.com/blog/style-radioes-radio-buttons-css adapted to Gravity Forms.
Uses Font Awesome. Make sure to wrap labels in <span> like so:
<script type="text/javascript">
jQuery(function($) {
$(".gfield_checkbox label, .gfield_radio label").wrapInner("<span></span>")
});
</script>
*/
div .gform_wrapper ul.gfield_radio li {
overflow-y: visible;
}
div .gform_wrapper .gfield_radio li input[type=radio] {
display: none;
}
div .gform_wrapper .gfield_radio label {
position: relative;
}
div .gform_wrapper .gfield_radio li label {
margin-left: 36px;
}
div .gform_wrapper .gfield_radio label span::before,
div .gform_wrapper .gfield_radio label span::after {
content: '';
margin: auto;
position: absolute;
top: 0; bottom: 0;
}
div .gform_wrapper .gfield_radio label span::before {
background-color: rgba(0, 0, 0, .1);
height: 25px;
left: -35px;
-webkit-transition: background-color .2s;
-moz-transition: background-color .2s;
-ms-transition: background-color .2s;
-o-transition: background-color .2s;
transition: background-color .2s;
width: 25px;
}
div .gform_wrapper .gfield_radio label span:hover::before {
background-color: rgba(0, 0, 0, .2);
}
div .gform_wrapper .gfield_radio label span::after {
color: transparent;
content: '\f00c';
font-family: 'FontAwesome';
line-height: 15px;
top: 3px; left: -30px;
-webkit-transition: color .2s;
-moz-transition: color .2s;
-ms-transition: color .2s;
-o-transition: color .2s;
transition: color .2s;
}
div .gform_wrapper .gfield_radio input[type="radio"]:checked + label span::after {
color: #229bee;
}
Copy link

ghost commented Aug 29, 2017

doesn't display the fa icons

@anythinggraphic
Copy link
Author

anythinggraphic commented Sep 16, 2017

@ezekielHawk, you have to wrap the labels in a tag. I updated the Gist to include the jQuery you need. I also updated the CSS to be more elegant, so paste the new CSS in as well.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment