CSS Style Guide

An overview of how to style read-only and disabled fields with CSS. Includes examples of how to target specific field types and different methods of styling.

Read the Walkthrough

Code

Filename: gpro-style-guide.css

/**
 * Gravity Perks // Read Only // CSS Style Guide
 * https://gravitywiz.com/how-to-style-gravity-forms-read-only-fields/
 *
 * An overview of how to style read-only and disabled fields with CSS. Includes examples of how to
 * target specific field types and different methods of styling.
 */
/* most field types */
.gform_wrapper input[readonly='readonly'] {
	/* custom styles */
}

/* selects */
.gform_wrapper select[disabled='disabled'] {
	/* custom styles */
}

/* checkboxes & radio buttons */
.gform_wrapper input[disabled='disabled'] {
	/* custom styles */
}

/* change font color */
.gform_wrapper input[readonly='readonly'] {
	color: #999;
}

/* hide the "input" */
.gform_wrapper input[readonly='readonly'] {
	border-color: transparent;
}

/* change the cursor */
.gform_wrapper input[readonly='readonly'] {
	cursor: not-allowed;
}

/* all together */
.gform_wrapper input[readonly='readonly'] {
	color: #999;
	border-color: transparent;
	cursor: not-allowed;
}

/* textareas */
.gform_wrapper textarea[readonly='readonly'] {
	/* custom styles */
}

/* checkbox & radio button labels */
.gform_wrapper input[disabled='disabled'] + label {
	/* custom styles */
}

Leave a Reply

Your email address will not be published. Required fields are marked *

  • Trouble installing this snippet? See our troubleshooting tips.
  • Need to include code? Create a gist and link to it in your comment.
  • Reporting a bug? Provide a URL where this issue can be recreated.

By commenting, I understand that I may receive emails related to Gravity Wiz and can unsubscribe at any time.