Skip to content

DigitalA11Y

Your Accessibility Partner

  • Home
  • ServicesExpand
    • Accessibility Audits
    • VPAT & ACR
    • Accessibility Consulting
    • Mobile Accessibility Audit
    • Design Reviews
    • Document Remediation
    • Accessibility Training
    • Ongoing Accessibility Support
  • Solutions
  • ResourcesExpand
    • A11Y Articles
    • Frequently Asked Accessibility Questions
    • WCAG Primer
    • ARIA Cheatsheet
    • A11Y Tools
    • A11Y Patterns
    • A11Y Cheatsheets
    • Free ToolsExpand
      • Accessibility Checker
      • A11Y Cost Calculator
      • A11Y Bookmarklets
      • Color Contrast Extension
      • WCAG Contrast Checker
  • 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
  • ACA

Resources

  • A11Y FAQs
  • Understanding WCAG
  • WCAG Checklist
  • Understanding WAI-ARIA

Legal

  • Privacy Policy
  • Terms and Conditions
  • Disclaimer
  • Accessibility Statement
  • Sitemap

© 2026 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: hello@digitala11y.com

Scroll to top
  • Home
  • Services
    • Accessibility Audits
    • VPAT & ACR
    • Accessibility Consulting
    • Mobile Accessibility Audit
    • Design Reviews
    • Document Remediation
    • Accessibility Training
    • Ongoing Accessibility Support
  • Solutions
  • Resources
    • A11Y Articles
    • Frequently Asked Accessibility Questions
    • WCAG Primer
    • ARIA Cheatsheet
    • A11Y Tools
    • A11Y Patterns
    • A11Y Cheatsheets
    • Free Tools
      • Accessibility Checker
      • A11Y Cost Calculator
      • A11Y Bookmarklets
      • Color Contrast Extension
      • WCAG Contrast Checker
  • Contact