<fieldset> instead of <div>?
Can I use the <fieldset> element to group, align and style <form> elements in place of a <div>? Removing the default style (border) and not using <legend>?
7 Replies
not only you could, but you should
it's a more semantic tag than a div
however, if you don't want to use the legend tag, i would still use it, but make it only visible to screen readers
by the way, fieldsets have a default border and other default styles, so, keep that in mind too
So if I use a <legend> and style it off-screen, I don't need to use an aria-label or aria-labelledby?
on the fieldset? i don't think so
Yes
but accessibility isn't my strongest suit
Ok
by the way, keep in mind that you can nest fieldsets and you can disable an entire fieldset instead of disabling individual fields