Skip to main content
Cornell University

Cornell Design System Documentation

Custom Development Team

  • Home
  • Template Structure
    • Template Structure Overview
    • Band (Layer 1)
    • Region (Layer 2)
    • Container (Layer 3)
    • Layout (Layer 4)
    • Section (Layer 5)
    • Block and Content (Layer 6)
  • Landmarks
    • Landmarks Overview
    • Footer
    • Header
    • Main content
    • Navigation
  • Components
    • Components Overview
    • Blockquote
    • Button
    • Checkboxes
    • Fieldset
    • Form inputs (other)
    • Form inputs (text)
    • Horizontal rule
    • List
    • Panel
    • Table
  • Patterns
    • Patterns Overivew
    • Accordion
    • Card
    • Tablist
  • Typography
    • Fonts
    • Headings
    • Icons
    • Images
    • Text and color
  • Development
    • Development Overview
    • Filters

On this page

  1. Code & Variants
    • Fieldsets
  2. Classes
    • {labels}
  3. Developer Notes
  4. Designer Notes

Fieldset

Fieldsets are a set of form controls optionally grouped under the same name. The name of the group is given by the first legend element that is a child of the fieldset. The remainder of the descendants form the group.

Code & Variants

Fieldsets

<fieldset class="{labels}">
    <legend></legend>
</fieldset>
Fieldset demo
Choose a number

It is also possible to nest fieldset elements within other fieldset elements.

Classes

To implement a style other than the default, add the class in question to the bracketed part of the code snippet.

{labels}

Class Description
Default (no class) The fieldset is outlined in a light border by default, with a visible legend on the top line. Form content is outlined by the fieldset.
.semantic The semantic fieldset displays its legend more like a heading.
.sr-only While legends are optional in HTML5, they are required for WCAG 2.0 compliance. If a legend is not needed visually, use the .sr-only class to make it exclusive to screen readers. Combining this with a .semantic fieldset will allow you to use fieldsets with no visual representation, which is appropriate in many cases.

Developer Notes

Avoid wrapping a long series of fields in a single fieldset, in many cases it causes issues when attempting to print the page containing the form.

Designer Notes

Nested fieldsets are supported but should be avoided if possible for easier accessibility. It may be a valid approach in some cases, however, such as organizing exceptionally complex forms.

Footer Content

This documentation for CDS was built using MkDocs.