Skip to content

DigitalA11Y

Your Accessibility Partner

  • Home
  • ServicesExpand
    • WCAG Audit Services
    • VPAT/ACR Services
    • Accessibility Consulting
    • PDF Remediation
    • Accessibility Trainings
    • Website Remediation
    • Design Audit
  • Free ToolsExpand
    • Accessibility Checker
    • A11Y Cost Calculator
    • A11Y Bookmarklets
    • Color Contrast Extension
    • WCAG Contrast Checker
  • ResourcesExpand
    • A11Y Articles
    • WCAG Primer
    • ARIA Cheatsheet
    • A11Y Tools
    • A11Y Patterns
    • A11Y Cheatsheets
  • Contact
Search
DigitalA11Y
Your Accessibility Partner
Search

Faked Fieldset/Legend using ARIA

Admittedly, browsers have a quite peculiar opinion on how to visually style <fieldset>/<legend> structures, and it is quite hard to override their preferences.

So if for visual (or any other serious) reason you cannot use standard <fieldset>/<legend>, you may take ARIA to the rescue:

  • Use role="group" to give a <div> container the semantics of a <fieldset>.
  • Associate any other text to the grouping container using aria-describedby.

Working Example

Gender

Explanation

As always, we highly recommend to use traditional solutions over ARIA, so if you haven’t done this yet, go back and read ARIA – when HTML simply is not enough.

Code

  • HTML
  • CSS
  • JavaScript
<form>
  <div aria-describedby="gender_legend" class="fieldset" role="group">
    <div class="legend" id="gender_legend">
      Gender
    </div>
    <div class="control">
      <input id="gender_male" name="gender" type="radio" value="male" /><label for="gender_male">Male</label>
    </div>
    <div class="control">
      <input id="gender_female" name="gender" type="radio" value="female" /><label for="gender_female">Female</label>
    </div>
  </div>
</form>
.control, .fieldset {
  margin: 6px 0;
}

label, .label {
  display: inline-block;
  width: 120px;
  vertical-align: top;
}

input + .label {
  width: auto;
}

.fieldset {
  position: relative;
  border: 2px groove threedface;
  padding: 10px;
  margin-bottom: 20px;
}

legend, .legend {
  background-color: #fff;
  position: absolute;
  left: 10px;
  top: -12px;
  padding: 2px;
}
NIL

Company

  • About
  • Blog
  • Careers
  • Contact

Services

  • Accessibility Audits
  • Accessibility Consulting
  • VPAT/ACR
  • Accessibility Trainings

Compliance

  • WCAG
  • ADA
  • Section 508
  • EN 301 549
  • EAA
  • AODA Compliance Services — Make Your Digital Assets Accessible in Ontario
  • ACA

Resources

  • Accessibility Resources
  • Understanding WCAG
  • WCAG Checklist
  • Understanding WAI-ARIA

Legal

  • Privacy Policy
  • Terms and Conditions
  • Disclaimer
  • Accessibility Statement for digitala11y.com
  • Sitemap

© 2025 DigitalA11Y
All Rights Reserved

Linkedin Twitter Facebook Instagram YouTube

DigitalA11Y
Plot No 108, 3rd Cross Rd, Saipuri Colony,
Hastinapuri Colony, Sainikpuri, Secunderabad -500094
Telangana, India.

Tel:(+91)99082 66680,
E-mail: [email protected]

Scroll to top
  • Home
  • Services
    • WCAG Audit Services
    • VPAT/ACR Services
    • Accessibility Consulting
    • PDF Remediation
    • Accessibility Trainings
    • Website Remediation
    • Design Audit
  • Free Tools
    • Accessibility Checker
    • A11Y Cost Calculator
    • A11Y Bookmarklets
    • Color Contrast Extension
    • WCAG Contrast Checker
  • Resources
    • A11Y Articles
    • WCAG Primer
    • ARIA Cheatsheet
    • A11Y Tools
    • A11Y Patterns
    • A11Y Cheatsheets
  • Contact